1

I don't understand why cron is not really executing the command every 10 minutes.

in crontab -e I have added:

*/10 * * * * /var/www/myproject/recording/batch.pl

I could see in the cron log it is running every 10 mins:

Mar 17 10:50:01 host crond[26335]: (root) CMD (/var/www/myproject/recording/batch.pl)
Mar 17 11:00:01 host crond[26357]: (root) CMD (/var/www/myproject/recording/batch.pl)
Mar 17 11:10:01 host crond[26418]: (root) CMD (/var/www/myproject/recording/batch.pl)
Mar 17 11:20:01 host crond[26657]: (root) CMD (/var/www/myproject/recording/batch.pl)

but it is not really executing the command.

When I execute that command manually in the Linux console it is working fine.

3
  • Did you check your email? Mar 17, 2013 at 11:31
  • @MichaelHampton No? Where do I check that on Linux Mar 17, 2013 at 11:33
  • try putting /path/to/perl in front of your command Mar 17, 2013 at 11:35

3 Answers 3

2

how about setup your crontab like this

*/10 * * * * /usr/bin/perl /var/www/myproject/recording/batch.pl 2>&1 | tee -a /var/log/myproject-recording-batch.log

then you can tail the log file /var/log/myproject-recording-batch.log to trace the running

0
2

CRON doesn't inherit all your environments variables. Some software must be manually called (ie: calling ifconfigor /sbin/ifconfig is not equal if you don't have a valid $PATH environment variable).

Also make sure it is executable and that your shebang is correctly defined (otherwise you'll have to prepend your command with the interpreter).

2

As CloudWeavers said, it most be about a missing environmental variable, to check what exactly is missing you can edit the cronjob to log all it's standard output/error to a log file, so that you can review it to get what's stopping it:

*/10 * * * * /var/www/myproject/recording/batch.pl &> output.log

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .