69 |
|
|
70 |
/* --- Private Prototypes -------------------------------------------------- */ |
/* --- Private Prototypes -------------------------------------------------- */ |
71 |
static void do_init(); /* Initialize this application */ |
static void do_init(); /* Initialize this application */ |
72 |
static RETSIGTYPE do_reinit(int); /* Re-initialize the runtime application */ |
static RETSIGTYPE do_reload(int); /* Signalhandler for a daemon reload */ |
73 |
|
static void do_reinit(); /* Re-initialize the runtime application */ |
74 |
static void do_action(char **); /* Dispatch to the submitted action */ |
static void do_action(char **); /* Dispatch to the submitted action */ |
75 |
static RETSIGTYPE do_destroy(int); /* Finalize this application */ |
static RETSIGTYPE do_destroy(int); /* Finalize this application */ |
76 |
static void do_default(); /* Do default action */ |
static void do_default(); /* Do default action */ |
132 |
* in case we run in daemon mode this signal |
* in case we run in daemon mode this signal |
133 |
* will reload the configuration. |
* will reload the configuration. |
134 |
*/ |
*/ |
135 |
signal(SIGHUP, do_reinit); |
signal(SIGHUP, do_reload); |
136 |
|
|
137 |
/* |
/* |
138 |
* Register no interest for the SIGPIPE signal, |
* Register no interest for the SIGPIPE signal, |
227 |
|
|
228 |
|
|
229 |
/** |
/** |
230 |
* Re-Initialize the application - Usually called when |
* Re-Initialize the application - called if a |
231 |
* the runtime control file was changed during daemon |
* monit daemon receives the SIGHUP signal. |
|
* mode. |
|
232 |
*/ |
*/ |
233 |
static RETSIGTYPE do_reinit(int sig) { |
static void do_reinit() { |
234 |
|
|
235 |
char *bind_addr; |
char *bind_addr; |
236 |
int port= Run.httpdport; |
int port= Run.httpdport; |
237 |
|
|
238 |
|
Run.doreload= FALSE; |
239 |
signal(SIGHUP, SIG_IGN); |
|
|
|
|
240 |
bind_addr= Run.bind_addr?xstrdup(Run.bind_addr):NULL; |
bind_addr= Run.bind_addr?xstrdup(Run.bind_addr):NULL; |
241 |
|
|
242 |
log("Awakened by the SIGHUP signal\n"); |
log("Awakened by the SIGHUP signal\n"); |
300 |
|
|
301 |
free(bind_addr); |
free(bind_addr); |
302 |
|
|
|
signal(SIGHUP, do_reinit); |
|
|
|
|
303 |
} |
} |
304 |
|
|
305 |
|
|
422 |
|
|
423 |
|
|
424 |
/** |
/** |
425 |
|
* Signalhandler for a daemon reload call |
426 |
|
*/ |
427 |
|
static RETSIGTYPE do_reload(int sig) { |
428 |
|
|
429 |
|
signal(SIGHUP, SIG_IGN); |
430 |
|
Run.doreload= TRUE; |
431 |
|
signal(SIGHUP, do_reload); |
432 |
|
|
433 |
|
} |
434 |
|
|
435 |
|
|
436 |
|
/** |
437 |
* Wakeup a sleeping monit daemon. |
* Wakeup a sleeping monit daemon. |
438 |
* Returns TRUE on success otherwise FALSE |
* Returns TRUE on success otherwise FALSE |
439 |
*/ |
*/ |
536 |
|
|
537 |
sleep(Run.polltime); |
sleep(Run.polltime); |
538 |
|
|
539 |
|
if(Run.doreload) |
540 |
|
do_reinit(); |
541 |
|
|
542 |
} |
} |
543 |
|
|
544 |
} |
} |