Re: How to start program in cron script?

1998-11-23 Thread Carey Evans
[EMAIL PROTECTED] (Andy Spiegl) writes:

> > 0 8 * * * /usr/local/bin/myprogram 2>&1 | /usr/bin/logger -i -t 
> > myprogram
> > >/dev/null 2>&1 &

> That's a nice alternative, but I found that logger doesn't quit after
> myprogram is done.  What am I overlooking now?

The only thing that comes to mind is that myprogram starts something,
and logger won't exit until there's nothing left writing to _it_.

-- 
 Carey Evans  http://home.clear.net.nz/pages/c.evans/

"Is there anyone who actually believes that USAicans are so modest or
intellectually honest as to be unable to find someone to sue?" - Cameron Laird


Re: How to start program in cron script?

1998-11-19 Thread Andy Spiegl
According to Carey Evans  <[EMAIL PROTECTED]>:
> 
> To fix this, you need to stop "myprogram" from sending any output to cron.
Oh, of course!  I am so stupid.

> My recommendation would be:
> 
> 0 8 * * * /usr/local/bin/myprogram >/dev/null 2>&1 &
Yes, that was it.  Now it works.  Thanks a mill!

> 0 8 * * * /usr/local/bin/myprogram 2>&1 | /usr/bin/logger -i -t myprogram
> >/dev/null 2>&1 &
That's a nice alternative, but I found that logger doesn't quit after
myprogram is done.  What am I overlooking now?

Thanks again!
 Andy.

-- 
 Andy Spiegl, University of Technology, Muenchen, Germany
 E-Mail: [EMAIL PROTECTED] URL: http://www.spiegl.de
 Finger [EMAIL PROTECTED] for my PGP key
o  _ _ _
  - __o   __o  /\_   _ \\o  (_)\__/o  (_)
  --- _`\<,__`\<,__>(_) (_)/<_\_| \   _|/' \/
  -- (_)/ (_)  (_)/ (_)  (_)(_)   (_)(_)'  _\o_
 ~~~


Re: How to start program in cron script?

1998-11-16 Thread Carey Evans
[EMAIL PROTECTED] (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 auxw":
> 
>  spiegl   32585  1.7  0.0 0 0 Z  0:00 (test.sh )

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.