Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!spool.mu.edu!uunet!pmafire!dave From: dave@pmafire.inel.gov (Dave Remien) Newsgroups: comp.unix.sysv386 Subject: Re: SCO UNIX 3.2.2 Can't set login uid from cron Keywords: auto-exit Message-ID: <1991Apr06.225349.9822@pmafire.inel.gov> Date: 6 Apr 91 22:53:49 GMT Article-I.D.: pmafire.1991Apr06.225349.9822 References: <1991Apr02.123535.11230@pfm.rmt.sub.org> Distribution: wo Organization: WINCO Lines: 48 In article em@dce.ie (Eamonn McManus) writes: =>As an alternative to launching cron from rc, you can have it spawned by =>init. This is a little complicated, because the first thing the cron =>daemon does is to fork itself into the background. If you just try to =>launch it from inittab, init will think it has finished immediately and =>will end up launching a lot of cron daemons. What we do here is to launch =>a shell script that starts cron and then execs `pause', a program that =>just does a pause() system call. Then when we want a new cron, we kill =>the existing cron and the `pause'. => [...] =>Here is /etc/startcron, which we invoked from /etc/inittab: =>: use /bin/sh =># Start cron by removing an old FIFO and starting cron itself. =># We need this script because inittab commands are execed so there =># can't be more than one shell command. =># Aug 17 1990 =>rm -f /usr/lib/cron/FIFO =>trap "" 2 3 # Don't let console quit and intr affect cron. =>. /etc/TIMEZONE # Probably don't need =>/etc/cron =># Cron forks into the background so this script waits forever; kill the =># script when you kill cron, if you want to start a new cron. =>exec /etc/pause Instead of the pause, why not: sleep 2 # give cron time to fork and settle down exec wait_on `ps -e | grep cron | awk '{print $1}'` Where wait_on.c is: main(argc, argv) int argc; char *argv[]; { int proc_pid; proc_pid = atoi(argv[1]); while(!kill(proc_pid, 0))sleep(1); } At least you only have to croak the cron, that way. Dave -- Dave Remien +*+*+*+*+*+*+*+*+*+*+*+*+*+*+ WINCO Computer Engineering Group dave@pmafire.inel.gov or rzd@inel.gov "Dave Barry for President"