home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume13 / backups / restart.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-01-31  |  1.2 KB  |  62 lines

  1. static char rcsid[] = "$Header: restart.c,v 1.3 86/10/14 01:34:06 scooter Exp $";
  2.  
  3. /*
  4.  * restart
  5.  *
  6.  * This module controls the system restart after backup is complete
  7.  *
  8.  * $Log:    restart.c,v $
  9.  * Revision 1.3  86/10/14  01:34:06  scooter
  10.  * Added process specific startup/shutdown stuff
  11.  * 
  12.  *
  13.  */
  14.  
  15. #include    <stdio.h>
  16. #include    "backup.h"
  17. #include    "ulist.h"
  18. #include    <signal.h>
  19.  
  20. extern struct ulist    *u_list;
  21. extern int        our_pid,our_ppid;
  22.  
  23. restart()
  24. {
  25.     FILE *fs;
  26.     struct ulist *proc;
  27.     
  28.  
  29.     /*
  30.      * Restart stopped processes
  31.      */
  32.  
  33.     fprintf(stderr,"\n*** Restarting processes ...");
  34.  
  35.     for (proc = u_list ; proc != NULL ; proc = proc->next)
  36.     {
  37.         if (proc->pid < 5 || proc->pid == our_pid ||
  38.             proc->pid == our_ppid)continue;
  39.  
  40. #ifdef    DEBUG
  41.         if (x_opt)
  42.             if (proc->special_flag)
  43.                 printf("restarting %s with %s\n",
  44.                     proc->cmd,proc->proc_restart);
  45.             else
  46.                 printf("starting process %d\n",proc->pid);
  47.         else
  48. #endif    DEBUG
  49.         if (proc->special_flag)
  50.             system(proc->proc_restart);
  51.         else
  52.             kill(proc->pid,SIGCONT);
  53.     }
  54.  
  55.     unlink("/etc/nologin");        /* Make sure users can log in */
  56.  
  57.     unlink("/dev/printer");        /* Restart all of the printers */
  58.     system("/usr/lib/lpd");        /* Start the deaemon */
  59.  
  60.     return(0);
  61. }
  62.