/[monit]/monit/validate.c
ViewVC logotype

Diff of /monit/validate.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.23 by rory, Mon Nov 11 22:38:54 2002 UTC revision 1.24 by rory, Mon Nov 25 23:44:25 2002 UTC
# Line 84  static void vlog(char * report, int n, P Line 84  static void vlog(char * report, int n, P
84   * Walk the process-list and validate each process   * Walk the process-list and validate each process
85   */   */
86  void validate() {  void validate() {
87      
88    Process_T p;    Process_T p;
89    
90    if ( ! update_loadavg() ) {    if ( ! update_loadavg() ) {
91        
92      log("Update of loadavg has failed!\n");      log("Update of loadavg has failed!\n");
93        
94    }    }
95    
96    for (p= processlist; p; p= p->next) {    for (p= processlist; p; p= p->next) {
97        
98      do_validate(p);      do_validate(p);
99            
100    }    }
# Line 133  static void do_validate(Process_T p) { Line 133  static void do_validate(Process_T p) {
133    /* Test for running process */    /* Test for running process */
134    if (!(pid= is_process_running(p))) {    if (!(pid= is_process_running(p))) {
135            
     log("'%s' is not running.\n", p->name);  
136      do_start(p, "Reason: Process is not running.");      do_start(p, "Reason: Process is not running.");
137      goto reinstall;      goto reinstall;
138            
# Line 253  static void do_restart(Process_T p, char Line 252  static void do_restart(Process_T p, char
252    
253      log("Trying to restart '%s'\n", p->name);      log("Trying to restart '%s'\n", p->name);
254    
255      control_process(p, "stop", FORCE_CONTROL);      check_process(p->name, "stop", FALSE);
256      sleep(10); /* Wait for process termination */      sleep(10); /* Wait for process termination */
257    
258    }    }
# Line 289  static void do_start(Process_T p, char * Line 288  static void do_start(Process_T p, char *
288    if(p->mode!= MODE_PASSIVE) {    if(p->mode!= MODE_PASSIVE) {
289    
290      /* Start process and take care of dependants */      /* Start process and take care of dependants */
291      control_process(p, "start", FORCE_CONTROL);      check_process(p->name, "start", FALSE);
292    
293      /* In the case we just started our own smtp server we'll      /* In the case we just started our own smtp server we'll
294       * sleep before attempting to send alert */       * sleep before attempting to send alert */
# Line 339  static void do_stop(Process_T p, char *m Line 338  static void do_stop(Process_T p, char *m
338      sleep(3);      sleep(3);
339    
340      /* Stop the process and dependants */      /* Stop the process and dependants */
341      control_process(p, "stop", FORCE_CONTROL);      check_process(p->name, "stop", FALSE);
342    
343    } else {    } else {
344    

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26