wnp@dcs.UUCP (Wolf N. Paul) (02/17/88)
The following modification to the recently posted CRON by
S.R. Sampson will make it behave more like standard UNIX cron;
i.e. it will AUTOMATICALLY put itself in the background, and
can be started manually, as well as from /etc/rc.
I don't have diff handy, so this is not in standard format. Lines
marked with '>' are the new lines added by me; the rest is shown
for context.
Hope this is useful to someone.
Wolf Paul
-----------
main()
{
void wakeup(), killer();
> int status;
>
> status=fork();
>
> if ( status == (-1) ) /* Error - can't fork */
> {
> fprintf(stderr,"\007Cron: Error - can't fork!\n");
> exit(-1);
> }
> if ( status > 0 )
> exit(0);
>
> signal(SIGINT, SIG_IGN);
> signal(SIGHUP, SIG_IGN);
> signal(SIGQUIT, SIG_IGN);
if ((err = fopen(CRONERR, "a")) == (FILE *)NULL) {
-------------------------
--
Wolf N. Paul Phone: (214) 306-9101 (h) (214) 404-8077 (w)
3387 Sam Rayburn Run UUCP: ihnp4!killer!{dcs, doulos}!wnp
Carrollton, TX 75007 INTERNET: wnp@dcs.UUCP ESL: 62832882
Pat Robertson does NOT speak for all evangelical Christians--not for me, anyway!