vino
vino

Reputation: 119

why my crontab is not executing my shell script?

where to check the logs of cron job? I did pgrep cron it gave 2358 What does it mean?

    0 02 * * * /feedbatch/application/scripts/baselineUpdate.sh
    0 13 * * * /feedbatch/application/scripts/baselineUpdate.sh
    #0,10,20,30,40,50 * * * * /feedbatch/application/scripts/partialUpdate.sh
    */2 * * * * /feedbatch/application/scripts/partialUpdate.sh
    15 0 * * * /usr/sbin/logrotate -s $HOME/logrotate.status -f $HOME/endeca-logrotate.conf
    16 0 * * * /usr/sbin/logrotate -s $HOME/outputrotate.status -f $HOME/endeca-outputrotate.conf

Upvotes: 0

Views: 1164

Answers (2)

derlinuxer
derlinuxer

Reputation: 574

The cron daemon will log to default system logger. So it will be logged to messages or syslog. You can configure the rsyslog to log all cron log output separate file. This is a bit depending of your linux distribution. As follow an example to write cron log to separate file for Ubuntu12.04:
edit /etc/rsyslog.d/50-default.conf (uncommand the cron.* line)

...
auth,authpriv.*         /var/log/auth.log
*.*;auth,authpriv.none      -/var/log/syslog
#cron.*             /var/log/cron.log
#daemon.*           -/var/log/daemon.log
...

restart cron daemon.
Your cron output should be logged to /var/log/cron.log now.
That should get your an better overview about "cron doing".

Upvotes: 1

Konza
Konza

Reputation: 2173

Your scripts are in this location -- /feedbatch/ Please check whether a directory named feedbatch is there in / . and whether a normal user has permission to run the scripts inside it if the directory exists. Try to put all your scripts in a new bin folder.. thats a good practice..

Other scripts are in /usr/sbin/.... Here also the permission may be an issue. Try to put all these inside the root crontab. So that there wont be any permission issues. Also check if your username is there in /etc/cron.allow and /etc/cron.deny.Dont worry If these two files are not present. But if these files are there, please make sure that your name is there in cron.allow and not there in cron.deny

to access the root crontab do the following

su - root
crontab -e

Upvotes: 1

Related Questions