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

Diff of /monit/monitor.c

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

revision 1.51 by hauk, Mon Jun 16 22:06:15 2003 UTC revision 1.52 by hauk, Sun Jun 22 20:31:16 2003 UTC
# Line 326  static void do_action(char **args) { Line 326  static void do_action(char **args) {
326    } else if(IS(action, "start")) {    } else if(IS(action, "start")) {
327            
328      if(P) {      if(P) {
329        if(exist_daemon()) {        if(! IS(P, "all")) {
330          d_check_service(P, "start");          if(exist_daemon()) {
331              d_check_service(P, "start");
332            } else {
333              check_service(P, "start");
334            }
335        } else {        } else {
336          check_service(P, "start");          
337            if(Run.mygroup)
338                control_group(Run.mygroup, "start");
339            else
340                control("start");
341        }        }
342      } else {      } else {
343                goto error;
       if(Run.mygroup)  
         control_group(Run.mygroup, "start");  
       else  
         control("start");  
344      }      }
345        
346    } else if(IS(action, "stop")) {    } else if(IS(action, "stop")) {
347            
348      if(P) {      if(P) {
349        if(exist_daemon()) {        if(! IS(P, "all")) {
350          d_check_service(P, "stop");          if(exist_daemon()) {
351              d_check_service(P, "stop");
352            } else {
353              check_service(P, "stop");
354            }
355        } else {        } else {
356          check_service(P, "stop");          if(Run.mygroup)
357                control_group(Run.mygroup, "stop");
358            else
359                control("stop");
360        }        }
361      } else {      } else {
362                goto error;
       if(Run.mygroup)  
         control_group(Run.mygroup, "stop");  
       else  
         control("stop");  
363      }      }
364            
365    } else if(IS(action, "reload")) {    } else if(IS(action, "reload")) {
# Line 363  static void do_action(char **args) { Line 370  static void do_action(char **args) {
370    } else if(IS(action, "restart")) {    } else if(IS(action, "restart")) {
371            
372      if(P) {      if(P) {
373                if(! IS(P, "all")) {
374        if(! exist_service(P)) {          if(! exist_service(P)) {
375                      
376          error("%s: Cannot restart program '%s' -- not found in %s\n",            error("%s: Cannot restart program '%s' -- not found in %s\n",
377                prog, P, Run.controlfile);                  prog, P, Run.controlfile);
378                      
379          return;            return;
380              
381            }
382                    
383        }          if(exist_daemon()) {
384              d_check_service(P, "restart");
385            } else {
386              check_service(P, "restart");
387            }
388                
       if(exist_daemon()) {  
         d_check_service(P, "restart");  
389        } else {        } else {
         check_service(P, "restart");  
       }  
390                
391            if(Run.mygroup)
392                control_group(Run.mygroup, "restart");
393            else
394                control("restart");
395          }
396      } else {      } else {
397                goto error;
       if(Run.mygroup)  
           control_group(Run.mygroup, "restart");  
       else  
           control("restart");  
398      }      }
399            
400    } else if(IS(action, "status")) {    } else if(IS(action, "status")) {
# Line 405  static void do_action(char **args) { Line 415  static void do_action(char **args) {
415      validate();      validate();
416            
417    } else {    } else {
418        
419        error:
420      error("%s: invalid argument -- %s  (-h will show valid arguments)\n",      error("%s: invalid argument -- %s  (-h will show valid arguments)\n",
421            prog, action);            prog, action);
422      exit(1);      exit(1);
# Line 685  static void help() { Line 696  static void help() {
696    printf(" -V           Print version number and patchlevel\n");    printf(" -V           Print version number and patchlevel\n");
697    printf(" -h           Print this text\n");    printf(" -h           Print this text\n");
698    printf("Optional action arguments for non-daemon mode are as follows:\n");    printf("Optional action arguments for non-daemon mode are as follows:\n");
699    printf(" start        - Start all programs listed in the control file\n");    printf(" start all    - Start all programs listed in the control file\n");
700    printf(" start name   - Only start the named program in the control file\n");    printf(" start name   - Only start the named program in the control file\n");
701    printf(" stop         - Stop all programs listed in the control file\n");    printf(" stop all     - Stop all programs listed in the control file\n");
702    printf(" stop name    - Only stop the named program in the control file\n");    printf(" stop name    - Only stop the named program in the control file\n");
703    printf(" reload       - Reinitialize monit\n");    printf(" reload       - Reinitialize monit\n");
704    printf(" restart      - Stop and start all programs\n");    printf(" restart all  - Stop and start all programs\n");
705    printf(" restart name - Only restart the named program in the control file\n");    printf(" restart name - Only restart the named program in the control file\n");
706    printf(" status       - Print status information for each program\n");    printf(" status       - Print status information for each program\n");
707    printf(" quit         - Kill monit daemon process\n");    printf(" quit         - Kill monit daemon process\n");

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

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