58 |
* monit [options] {arguments} |
* monit [options] {arguments} |
59 |
* |
* |
60 |
* @author Jan-Henrik Haukeland, <hauk@tildeslash.com> |
* @author Jan-Henrik Haukeland, <hauk@tildeslash.com> |
61 |
|
* @author Martin Pala <martin.pala@hq.iol.cz> |
62 |
* @author Christian Hopp, <chopp@iei.tu-clausthal.de> |
* @author Christian Hopp, <chopp@iei.tu-clausthal.de> |
63 |
* |
* |
64 |
* @version \$Id$ |
* @version \$Id$ |
75 |
static void do_default(); /* Do default action */ |
static void do_default(); /* Do default action */ |
76 |
static RETSIGTYPE do_wakeup(int); /* Signalhandler for a daemon wakeup call */ |
static RETSIGTYPE do_wakeup(int); /* Signalhandler for a daemon wakeup call */ |
77 |
static int do_wakeupcall(); /* Wakeup a sleeping monit daemon */ |
static int do_wakeupcall(); /* Wakeup a sleeping monit daemon */ |
78 |
|
static RETSIGTYPE do_restart(int sig); /* Signalhandler for daemon restart */ |
79 |
static void do_wait(); /* Wait for 10 seconds */ |
static void do_wait(); /* Wait for 10 seconds */ |
80 |
static void handle_options(int, char **); /* Handle program options */ |
static void handle_options(int, char **); /* Handle program options */ |
81 |
static void help(); /* Print program help message to stdout */ |
static void help(); /* Print program help message to stdout */ |
83 |
static void stop_http(); /* Stop monit http */ |
static void stop_http(); /* Stop monit http */ |
84 |
static void start_http(); /* Start monit http */ |
static void start_http(); /* Start monit http */ |
85 |
|
|
86 |
|
|
87 |
/** |
/** |
88 |
* The Prime mover |
* The Prime mover |
89 |
*/ |
*/ |
129 |
signal(SIGUSR1, do_wakeup); |
signal(SIGUSR1, do_wakeup); |
130 |
|
|
131 |
/* |
/* |
132 |
|
* Register interest for the SIGHUP signal, |
133 |
|
* in case we run in daemon mode this signal |
134 |
|
* will restart the monit daemon. |
135 |
|
*/ |
136 |
|
signal(SIGHUP, do_restart); |
137 |
|
|
138 |
|
/* |
139 |
* Register no interest for the SIGPIPE signal, |
* Register no interest for the SIGPIPE signal, |
140 |
*/ |
*/ |
141 |
signal(SIGPIPE, SIG_IGN); |
signal(SIGPIPE, SIG_IGN); |
395 |
|
|
396 |
} |
} |
397 |
|
|
398 |
|
|
399 |
|
/** |
400 |
|
* Signalhandler for a daemon restart call. The timestamp of the |
401 |
|
* control file is changed with the effect that a monit daemon will |
402 |
|
* restart itself, including closing and reopening log files. |
403 |
|
*/ |
404 |
|
static RETSIGTYPE do_restart(int sig) { |
405 |
|
|
406 |
|
signal(SIGHUP, SIG_IGN); |
407 |
|
Run.timestamp= 0; |
408 |
|
log("Awakened by the SIGHUP signal\n"); |
409 |
|
signal(SIGHUP, do_restart); |
410 |
|
|
411 |
|
} |
412 |
|
|
413 |
|
|
414 |
/** |
/** |
415 |
* Wakeup a sleeping monit daemon. |
* Wakeup a sleeping monit daemon. |