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

Diff of /monit/control.c

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

revision 1.45 by hauk, Fri Jun 6 16:43:06 2003 UTC revision 1.46 by martinp, Mon Jun 9 19:33:41 2003 UTC
# Line 206  void check_process(char *P, char *action Line 206  void check_process(char *P, char *action
206    
207    if(IS(action, "start")) {    if(IS(action, "start")) {
208            
209      if(is_process_running(p)) {      if(p->task==TASK_PROCESS && is_process_running(p)) {
210    
211        if(!p->do_validate) {        if(!p->do_validate) {
212    
# Line 305  static void do_start(Process_T p) { Line 305  static void do_start(Process_T p) {
305      }      }
306    }    }
307        
308    if(p->start && (!is_process_running(p))) {    if(p->start && (p->task!=TASK_PROCESS || !is_process_running(p))) {
309      log("start: (%s) %s\n", p->name, p->start->arg[0]);      log("start: (%s) %s\n", p->name, p->start->arg[0]);
310      spawn(p, p->start);      spawn(p, p->start);
311      wait_start(p);      if(p->task==TASK_PROCESS)
312          wait_start(p);
313    }    }
314        
315    LOCK(Run.mutex)    LOCK(Run.mutex)
# Line 339  static void do_stop(Process_T p) { Line 340  static void do_stop(Process_T p) {
340    
341    DEBUG("Monitoring disabled -- process %s\n", p->name);    DEBUG("Monitoring disabled -- process %s\n", p->name);
342    
343    if(p->stop && is_process_running(p)) {    if(p->stop && (p->task!=TASK_PROCESS || is_process_running(p))) {
344      log("stop: (%s) %s\n", p->name, p->stop->arg[0]);      log("stop: (%s) %s\n", p->name, p->stop->arg[0]);
345      spawn(p, p->stop);      spawn(p, p->stop);
346      wait_stop(p);      if(p->task==TASK_PROCESS)
347          wait_stop(p);
348    }    }
349    
350    /* Reset the proc info object in case of a later restart */    /* Reset the proc info object in case of a later restart */
# Line 404  static void wait_start(Process_T p) { Line 406  static void wait_start(Process_T p) {
406    
407    while(max_tries--) {    while(max_tries--) {
408      if(is_process_running(p))      if(is_process_running(p))
409          break;        break;
410      sleep(1);      sleep(1);
411    }    }
412        
# Line 426  static void wait_stop(Process_T p) { Line 428  static void wait_stop(Process_T p) {
428    
429    while(max_tries--) {    while(max_tries--) {
430      if(!is_process_running(p))      if(!is_process_running(p))
431          break;        break;
432      sleep(1);      sleep(1);
433    }    }
434    

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.46

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