home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1696 / demon.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-28  |  933 b   |  37 lines

  1. static char rcsid[] = "@(#)$Id: idle_demon.c,v 2.1  07/18/90  jbc $";
  2. /***************************************************************************/
  3. /* Copyright (c) 1990  James B. Cummings, Jr.                              */
  4. /*                                                                         */
  5. /*  This program is offered in the Public Domain and is freely available   */
  6. /*    as long as this notice is kept intact with each module.              */
  7. /***************************************************************************/
  8. #include "header.h"
  9.  
  10. main()
  11. {
  12.     char path[80];
  13.     int i;
  14.     int fid, status;
  15.     void perror();
  16.  
  17.     for(i = 0;i <= 79;i++)
  18.         path[i] == '\0';
  19.  
  20.     (void) strcpy(path,BIN);
  21.     (void) strcat(path,"/");
  22.     (void) strcat(path,APROG);
  23.  
  24.     for(;;) {
  25.         if((fid = fork()) < 0)
  26.             perror("fork");
  27.  
  28.         if(fid == 0) {
  29.             execl(path,"idle_check",0);
  30.             exit(1);
  31.         }
  32.         while(wait(&status) != fid)
  33.             ;
  34.         (void) sleep(120);
  35.     }
  36. }
  37.