* Cron and background process problems
@ 2000-04-07 4:00 Dale Caldwell
2000-04-07 4:00 ` Barry Margolin
0 siblings, 1 reply; 2+ messages in thread
From: Dale Caldwell @ 2000-04-07 4:00 UTC (permalink / raw)
I'm trying to resolve a problem with cron running a script. (Compaq Tru64,
v4.0F system, using Bourne shell script)
I have some internet API processes that I need running 24/7. I've put
together a script to look for these individual processes and restart any
that have failed.
Basic logic:
#!/bin/sh
look at process list
if process X not found
log message "process not found"
restart process &
log message X restarted
do a "ps -ef |grep X" and log output to file
end
This script works great manually. I can kill all or selective processes,
run my script and the appropriate action is taken, then the log file is
emailed to me.
If I put the script into crontab, running every 5 minutes, the log file is
sent, but the processes don't exist.
I suspect that every time cron runs, restarts the 'dead' process, it then
shuts down. When cron shuts down, the processes are being killed.
Here is a sample of my restart command. It should be sent to the background
(&) I think.
Does anyone have any cron knowledge that could explain why this happens? I
can manually run the script, log completely off the system, and the API
processes will be left running.
I'm lost.
Thanks - Dale
dale@gardeners.com
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Cron and background process problems
2000-04-07 4:00 Cron and background process problems Dale Caldwell
@ 2000-04-07 4:00 ` Barry Margolin
0 siblings, 0 replies; 2+ messages in thread
From: Barry Margolin @ 2000-04-07 4:00 UTC (permalink / raw)
In article <38ee53a1@news.together.net>,
Dale Caldwell <dalec@together.net> wrote:
>This script works great manually. I can kill all or selective processes,
>run my script and the appropriate action is taken, then the log file is
>emailed to me.
>
>If I put the script into crontab, running every 5 minutes, the log file is
>sent, but the processes don't exist.
Many people post messages saying that a script works fine manually, but not
from cron. This is almost always due to the fact that the script depends
on environment settings from their .profile, .login, or .cshrc. Since none
of these are executed by a cron job, scripts that depend on them fail.
>I suspect that every time cron runs, restarts the 'dead' process, it then
>shuts down. When cron shuts down, the processes are being killed.
I don't think so.
--
Barry Margolin, barmar@genuity.net
Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-04-07 4:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-04-07 4:00 Cron and background process problems Dale Caldwell
2000-04-07 4:00 ` Barry Margolin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox