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

Diff of /monit/monitor.c

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

revision 1.46 by martinp, Fri Feb 14 08:22:33 2003 UTC revision 1.47 by hauk, Mon Feb 17 15:34:19 2003 UTC
# Line 69  Line 69 
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 */
# Line 131  static void do_init() { Line 132  static void do_init() {
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,
# Line 226  static void do_init() { Line 227  static void do_init() {
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");
# Line 301  static RETSIGTYPE do_reinit(int sig) { Line 300  static RETSIGTYPE do_reinit(int sig) {
300    
301    free(bind_addr);    free(bind_addr);
302    
   signal(SIGHUP, do_reinit);  
   
303  }  }
304    
305    
# Line 425  static RETSIGTYPE do_wakeup(int sig) { Line 422  static RETSIGTYPE do_wakeup(int sig) {
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   */   */
# Line 527  static void do_default() { Line 536  static void do_default() {
536    
537        sleep(Run.polltime);        sleep(Run.polltime);
538    
539          if(Run.doreload)
540              do_reinit();
541    
542      }      }
543            
544    }    }

Legend:
Removed from v.1.46  
changed lines
  Added in v.1.47

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