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

Diff of /monit/control.c

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

revision 1.50 by hauk, Thu Jun 26 14:24:11 2003 UTC revision 1.51 by hauk, Wed Jul 2 19:32:02 2003 UTC
# Line 161  void d_check_service(char *P, char *acti Line 161  void d_check_service(char *P, char *acti
161   * Check to see if we should try to start/stop service   * Check to see if we should try to start/stop service
162   * @param P A service name as stated in the config file   * @param P A service name as stated in the config file
163   * @param action A string describing the action to execute   * @param action A string describing the action to execute
164     * @return TRUE if the service was handled successfully otherwise FALSE
165   */   */
166  void check_service(char *P, char *action) {  void check_service(char *P, char *action) {
167    
# Line 179  void check_service(char *P, char *action Line 180  void check_service(char *P, char *action
180            
181      if(s->task==TASK_PROCESS && is_process_running(s)) {      if(s->task==TASK_PROCESS && is_process_running(s)) {
182    
183        if(!s->do_validate) {        if(!s->do_monitor) {
184    
185          LOCK(Run.mutex)          LOCK(Run.mutex)
186            s->do_validate= TRUE;            s->do_monitor= TRUE;
187          END_LOCK;          END_LOCK;
188    
189          DEBUG("Monitoring enabled -- process %s\n", s->name);          DEBUG("Monitoring enabled -- process %s\n", s->name);
# Line 219  void check_service(char *P, char *action Line 220  void check_service(char *P, char *action
220        log("%s: Start or stop method not defined -- process %s\n",        log("%s: Start or stop method not defined -- process %s\n",
221              prog, P);              prog, P);
222        return;        return;
223        } else {
224          log("Trying to restart '%s'\n", s->name);
225      }      }
226            
227      do_depend(s, "stop");      do_depend(s, "stop");
# Line 284  static void do_start(Service_T s) { Line 287  static void do_start(Service_T s) {
287    }    }
288        
289    LOCK(Run.mutex)    LOCK(Run.mutex)
290      s->do_validate= TRUE;      s->do_monitor= TRUE;
291    END_LOCK;    END_LOCK;
292    
293    DEBUG("Monitoring enabled -- process %s\n", s->name);    DEBUG("Monitoring enabled -- process %s\n", s->name);
# Line 306  static void do_stop(Service_T s) { Line 309  static void do_stop(Service_T s) {
309    s->depend_visited= TRUE;    s->depend_visited= TRUE;
310        
311    LOCK(Run.mutex)    LOCK(Run.mutex)
312      s->do_validate= FALSE;      s->do_monitor= FALSE;
313    END_LOCK;    END_LOCK;
314    
315    DEBUG("Monitoring disabled -- service %s\n", s->name);    DEBUG("Monitoring disabled -- service %s\n", s->name);
# Line 382  static void wait_start(Service_T s) { Line 385  static void wait_start(Service_T s) {
385    }    }
386        
387    if(!is_process_running(s))    if(!is_process_running(s))
388        log("%s: Warning process '%s' was not started\n", prog, s->name);        log("failed: to start (%s)\n", s->name);
389        
390  }  }
391    
# Line 404  static void wait_stop(Service_T s) { Line 407  static void wait_stop(Service_T s) {
407    }    }
408    
409    if(is_process_running(s))    if(is_process_running(s))
410        log("%s: Warning process '%s' was not stopped\n", prog, s->name);        log("failed: to stop (%s)\n", s->name);
411    
412  }  }

Legend:
Removed from v.1.50  
changed lines
  Added in v.1.51

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