From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,aba8e38b318a2635,start X-Google-Attributes: gidfee84,public X-Google-Thread: 1012a6,aba8e38b318a2635,start X-Google-Attributes: gid1012a6,public From: "Dale Caldwell" Subject: Cron and background process problems Date: 2000/04/07 Message-ID: <38ee53a1@news.together.net>#1/1 X-Deja-AN: 608151212 X-Trace: 7 Apr 2000 17:31:13 -0500, 208.5.171.140 Organization: Together Networks - Burlington, VT. X-MSMail-Priority: Normal X-Priority: 3 Newsgroups: comp.unix.shell,comp.unix.osf.osf1 X-Mimeole: Produced By Microsoft MimeOLE V5.00.2919.6600 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