ashalaenko
July 30th, 2012, 01:38 PM
cd some_dir && php some_crone.php || echo "$? $_" | xargs ./some_handler.php
So when I run this code from console I got a correct value for $? and for $_
$? - exit status $_ - Gives the last argument to the previous command. At the shell startup, it gives the absolute filename of the shell script being executed.
But when I put this code to cronjob :
crontab -e
*/1 * * * * cd some_dir && php some_crone.php || echo "$? $_" | xargs ./some_handler.php
I got an empty $_. Please help. I can not understand what a problem?
So when I run this code from console I got a correct value for $? and for $_
$? - exit status $_ - Gives the last argument to the previous command. At the shell startup, it gives the absolute filename of the shell script being executed.
But when I put this code to cronjob :
crontab -e
*/1 * * * * cd some_dir && php some_crone.php || echo "$? $_" | xargs ./some_handler.php
I got an empty $_. Please help. I can not understand what a problem?