189 |
*/ |
*/ |
190 |
if(Run.testing) { |
if(Run.testing) { |
191 |
|
|
192 |
error("Control file syntax OK\n"); |
log("Control file syntax OK\n"); |
193 |
exit(0); |
exit(0); |
194 |
|
|
195 |
} |
} |
364 |
|
|
365 |
} else if(IS(action, "reload")) { |
} else if(IS(action, "reload")) { |
366 |
|
|
367 |
error("Reinitializing monit daemon\n", prog); |
log("Reinitializing monit daemon\n", prog); |
368 |
kill_daemon(SIGHUP); |
kill_daemon(SIGHUP); |
369 |
|
|
370 |
} else if(IS(action, "restart")) { |
} else if(IS(action, "restart")) { |
373 |
if(! IS(P, "all")) { |
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", |
log("%s: Cannot restart program '%s' -- not found in %s\n", |
377 |
prog, P, Run.controlfile); |
prog, P, Run.controlfile); |
378 |
|
|
379 |
return; |
return; |
407 |
|
|
408 |
} else if(IS(action, "quit")) { |
} else if(IS(action, "quit")) { |
409 |
|
|
410 |
error("Stopping monit daemon\n", prog); |
log("Stopping monit daemon\n", prog); |
411 |
kill_daemon(SIGTERM); |
kill_daemon(SIGTERM); |
412 |
|
|
413 |
} else if(IS(action, "validate")) { |
} else if(IS(action, "validate")) { |
417 |
} else { |
} else { |
418 |
|
|
419 |
error: |
error: |
420 |
error("%s: invalid argument -- %s (-h will show valid arguments)\n", |
log("%s: invalid argument -- %s (-h will show valid arguments)\n", |
421 |
prog, action); |
prog, action); |
422 |
exit(1); |
exit(1); |
423 |
|
|
463 |
if((pid= exist_daemon()) > 0) { |
if((pid= exist_daemon()) > 0) { |
464 |
|
|
465 |
kill(pid, SIGUSR1); |
kill(pid, SIGUSR1); |
466 |
error("%s daemon at %d awakened\n", prog, pid); |
log("%s daemon at %d awakened\n", prog, pid); |
467 |
|
|
468 |
return TRUE; |
return TRUE; |
469 |
|
|
601 |
Run.isdaemon= TRUE; |
Run.isdaemon= TRUE; |
602 |
sscanf(optarg, "%d", &Run.polltime); |
sscanf(optarg, "%d", &Run.polltime); |
603 |
if(Run.polltime<1) { |
if(Run.polltime<1) { |
604 |
error("%s: option -%c requires a natural number\n", prog, opt); |
log("%s: option -%c requires a natural number\n", prog, opt); |
605 |
exit(1); |
exit(1); |
606 |
} |
} |
607 |
break; |
break; |
659 |
case 'g': |
case 'g': |
660 |
case 'l': |
case 'l': |
661 |
case 'p': |
case 'p': |
662 |
error("%s: option -- %c requires an argument\n", prog, optopt); |
log("%s: option -- %c requires an argument\n", prog, optopt); |
663 |
break; |
break; |
664 |
default: |
default: |
665 |
error("%s: invalid option -- %c (-h will show valid options)\n", |
log("%s: invalid option -- %c (-h will show valid options)\n", |
666 |
prog, optopt); |
prog, optopt); |
667 |
|
|
668 |
} |
} |