Cronjob terminates early

Posted by TheBigO on Super User See other posts from Super User or by TheBigO
Published on 2011-11-12T16:21:45Z Indexed on 2011/11/12 17:56 UTC
Read the original article Hit count: 187

Filed under:
|

In my crontab file I execute a script like so (I edit the crontab using sudo crontab -e):

01 * * * * bash /etc/m/start.sh

The script runs some other scripts like so:

sudo bash -c "/etc/m/abc.sh --option=1" &
sleep 2
sudo bash -c "/etc/m/abc.sh --option=2" &

When cron runs the script start.sh, I do ps aux | grep abc.sh and I see the abc.sh script running.

After a couple of seconds, the script is no longer running, even though abc.sh should take hours to finish.

If I do sudo bash /etc/m/start.sh & from the command line, everything works fine (the abc.sh scripts run for hours in the background until they complete).

How do I debug this?

Is there something I'm doing that is preventing these scripts from running in the background until they are done?

© Super User or respective owner

Related posts about bash

Related posts about cron