cron question -- some commands not executing
> 15 14 * * * ~/test.pl
and this does not get executed (modified slightly for posting here) > 50 10 * * * ~/test.pl none
50 10 * * * '~/test.pl single'
50 10 * * * "~/test.pl double" i've tried using single and double quotes around it to no avail.
could someone explain why it is not taking the arguments given to it?
when i modified test.pl to have optional arguments the arguments failed to show.
note: i would greatly prefer an explanation of why the argument failed to be taken in the cron job than someone posting a fixed version that does work. i will learn much more by reading the explanation
2 Replies
50 10 * * * ~/test.pl single
Put in command
, not 'command'. I'm not entirely sure though, but worth a shot.
@tierra:
I believe the line is executed with /bin/sh, putting it in quotes is like passing a string around. You probably want:
50 10 * * *
~/test.pl single
Put in
command
, not 'command'. I'm not entirely sure though, but worth a shot.
No, with backquotes, it will try to execute the output of "~/test.pl single", which unlikely to be useful.
To the original poster: you have checked to make sure it runs
from the command line, yes? Under /bin/sh? Try
/bin/sh -c '~/test.pl single'
In the crontab itself, you do NOT want quotes around the whole thing, your first line
50 10 * * * ~/test.pl none
should work.