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

Diff of /monit/control.c

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

revision 1.89 by martinp, Mon Mar 14 23:11:46 2005 UTC revision 1.90 by martinp, Sun Apr 10 21:13:37 2005 UTC
# Line 73  static void  do_start(Service_T); Line 73  static void  do_start(Service_T);
73  static int   do_stop(Service_T);  static int   do_stop(Service_T);
74  static void  do_monitor(Service_T);  static void  do_monitor(Service_T);
75  static void  do_unmonitor(Service_T);  static void  do_unmonitor(Service_T);
 static void  monitor_set(Service_T);  
76  static void *wait_start(void *);  static void *wait_start(void *);
77  static int   wait_stop(Service_T);  static int   wait_stop(Service_T);
78  static void  do_depend(Service_T, const char *);  static void  do_depend(Service_T, const char *);
# Line 142  void control_service(const char *S, cons Line 141  void control_service(const char *S, cons
141            
142      if(s->type==TYPE_PROCESS && Util_isProcessRunning(s)) {      if(s->type==TYPE_PROCESS && Util_isProcessRunning(s)) {
143        DEBUG("%s: Process already running -- process %s\n", prog, S);        DEBUG("%s: Process already running -- process %s\n", prog, S);
144        monitor_set(s);        Util_monitorSet(s);
145        return;        return;
146      }      }
147            
148      if(s->type==TYPE_PROCESS && !s->start) {      if(s->type==TYPE_PROCESS && !s->start) {
149        DEBUG("%s: Start method not defined -- process %s\n", prog, S);        DEBUG("%s: Start method not defined -- process %s\n", prog, S);
150        monitor_set(s);        Util_monitorSet(s);
151        return;        return;
152      }      }
153            
# Line 171  void control_service(const char *S, cons Line 170  void control_service(const char *S, cons
170            
171      if(s->type==TYPE_PROCESS && (!s->start || !s->stop)) {      if(s->type==TYPE_PROCESS && (!s->start || !s->stop)) {
172        DEBUG("%s: Start or stop method not defined -- process %s\n", prog, S);        DEBUG("%s: Start or stop method not defined -- process %s\n", prog, S);
173        monitor_set(s);        Util_monitorSet(s);
174        return;        return;
     } else {  
       log("'%s' trying to restart\n", s->name);  
175      }      }
176    
177        log("'%s' trying to restart\n", s->name);
178            
179      do_depend(s, "stop");      do_depend(s, "stop");
180      if(do_stop(s)) {      if(do_stop(s)) {
# Line 272  static void do_start(Service_T s) { Line 271  static void do_start(Service_T s) {
271      }      }
272    }    }
273    
274    monitor_set(s);    Util_monitorSet(s);
275    
276  }  }
277    
# Line 336  static void do_monitor(Service_T s) { Line 335  static void do_monitor(Service_T s) {
335      }      }
336    }    }
337        
338    monitor_set(s);    Util_monitorSet(s);
339        
340  }  }
341    
# Line 359  static void do_unmonitor(Service_T s) { Line 358  static void do_unmonitor(Service_T s) {
358  }  }
359    
360    
 /*  
  * This will enable service monitoring in the case that it was disabled  
  * @param s A Service_T object  
  */  
 static void monitor_set(Service_T s) {  
   
   ASSERT(s);  
   
   if(!s->monitor) {  
     s->monitor= MONITOR_INIT;  
     DEBUG("Monitoring enabled -- service %s\n", s->name);  
   }  
   
 }  
   
   
361  /*  /*
362   * This is an in-fix recursive function called before s is started to   * This is an in-fix recursive function called before s is started to
363   * stop every service that depends on s, in reverse order *or* after s   * stop every service that depends on s, in reverse order *or* after s

Legend:
Removed from v.1.89  
changed lines
  Added in v.1.90

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