Re: How to start program in cron script?
news.spiegl@kascada.com (Andy Spiegl) writes:
> I am giving up. For at least an hour I tried to write a
> shell script (t obe run by cron) that start another program
> and sends it into the background.
[snip]
> But no matter how I did it, I ended up with the program running
> as it should but the starting shell script (let's call it test.sh)
> became a zombie: Output from "ps auxwwwww":
>
> spiegl 32585 1.7 0.0 0 0 Z 0:00 (test.sh <zombie>)
I would guess that:
1. cron doesn't monitor for its children exiting;
2. cron waits for everything sending output its way to exit before
exiting itself. "ps afx" can be instructive for working out
_whose_ zombie test.sh is.
To fix this, you need to stop "myprogram" from sending any output to
cron. My recommendation would be:
0 8 * * * /usr/local/bin/myprogram >/dev/null 2>&1 &
if you don't care at all about the output, or
0 8 * * * /usr/local/bin/myprogram 2>&1 | /usr/bin/logger -i -t myprogram >/dev/null 2>&1 &
(all on one line, of course) to send any output to the syslog.
--
Carey Evans http://home.clear.net.nz/pages/c.evans/
Close your eyes.
Reply to: