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

Diff of /monit/control.c

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

revision 1.27 by hauk, Thu Dec 19 21:47:55 2002 UTC revision 1.28 by hauk, Thu Dec 19 22:03:46 2002 UTC
# Line 201  void check_process(char *P, char *action Line 201  void check_process(char *P, char *action
201    }    }
202    
203    if(toggle_validate_flag) {    if(toggle_validate_flag) {
204        
205      if( is(action, "start")) {      if( is(action, "start")) {
206        LOCK(Run.mutex)        LOCK(Run.mutex)
207          p->do_validate= TRUE;            p->do_validate= TRUE;
       END_LOCK;  
   
       if(Run.debug)  
         log("Monitoring enabled -- process %s\n", p->name);  
   
     }  
   
     if( is(action, "stop")) {  
       LOCK(Run.mutex)  
         p->do_validate= FALSE;  
208        END_LOCK;        END_LOCK;
209          
210        if(Run.debug)        if(Run.debug)
211          log("Monitoring disabled -- process %s\n", p->name);            log("Monitoring enabled -- process %s\n", p->name);
   
212      }      }
213      }
214    
   }  
     
215    if(is(action, "start")) {    if(is(action, "start")) {
216            
217      if(is_process_running(p)) {      if(is_process_running(p)) {
218        return;        return;
219      }      }
220        
221      if(!p->start) {      if(!p->start) {
222        error("%s: Start method not defined -- process %s\n",        error("%s: Start method not defined -- process %s\n",
223              prog, P);              prog, P);
# Line 252  void check_process(char *P, char *action Line 240  void check_process(char *P, char *action
240            
241    }    }
242        
243      if(toggle_validate_flag) {
244        
245        if( is(action, "stop")) {
246          LOCK(Run.mutex)
247              p->do_validate= FALSE;
248          END_LOCK;
249          
250          if(Run.debug)
251              log("Monitoring disabled -- process %s\n", p->name);
252        }
253      }
254      
255  }  }
256    
257    
# Line 302  static void do_start(Process_T p) { Line 302  static void do_start(Process_T p) {
302      }      }
303    }    }
304        
305    if(p->start && (!is_process_running(p))) {    if(p->start && p->do_validate && (!is_process_running(p))) {
306      log("start: (%s) %s\n", p->name, p->start->arg[0]);      log("start: (%s) %s\n", p->name, p->start->arg[0]);
307      spawn(p, p->start);      spawn(p, p->start);
308      /* Wait until the process is actually started */      /* Wait until the process is actually started */
# Line 332  static void do_stop(Process_T p) { Line 332  static void do_stop(Process_T p) {
332        
333    p->depend_visited= TRUE;    p->depend_visited= TRUE;
334        
335    if(p->stop && is_process_running(p)) {    if(p->stop && p->do_validate && is_process_running(p)) {
336      log("stop: (%s) %s\n", p->name, p->stop->arg[0]);      log("stop: (%s) %s\n", p->name, p->stop->arg[0]);
337      spawn(p, p->stop);      spawn(p, p->stop);
338      memset(p->procinfo, 0, sizeof *(p->procinfo));      memset(p->procinfo, 0, sizeof *(p->procinfo));
# Line 383  static void do_dependandt(Process_T p, c Line 383  static void do_dependandt(Process_T p, c
383        for(d= parent->dependantlist; d; d= d->next)        for(d= parent->dependantlist; d; d= d->next)
384            if(is(d->dependant, p->name))            if(is(d->dependant, p->name))
385                break;                break;
386        if(d && p->stop && p->start) {        if(d && p->stop && p->start && p->do_validate) {
387    
388          if(is(action, "stop")) {          if(is(action, "stop")) {
389            if(is_process_running(parent)) {            if(is_process_running(parent)) {

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28

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