/[cvs]/eggdrop1.8/src/main.c
ViewVC logotype

Diff of /eggdrop1.8/src/main.c

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

revision 1.5 by pseudo, Tue Oct 19 14:20:56 2010 UTC revision 1.6 by pseudo, Sat Oct 23 11:16:12 2010 UTC
# Line 127  char ver[41];        /* Version info (sh Line 127  char ver[41];        /* Version info (sh
127  char egg_xtra[2048]; /* Patch info                */  char egg_xtra[2048]; /* Patch info                */
128    
129  int do_restart = 0;       /* .restart has been called, restart ASAP */  int do_restart = 0;       /* .restart has been called, restart ASAP */
 int die_on_sighup = 0;    /* Die if bot receives SIGHUP             */  
 int die_on_sigterm = 1;   /* Die if bot receives SIGTERM            */  
130  int resolve_timeout = 15; /* Hostname/address lookup timeout        */  int resolve_timeout = 15; /* Hostname/address lookup timeout        */
131  char quit_msg[1024];      /* Quit message                           */  char quit_msg[1024];      /* Quit message                           */
132    
# Line 181  void fatal(const char *s, int recoverabl Line 179  void fatal(const char *s, int recoverabl
179    ssl_cleanup();    ssl_cleanup();
180  #endif  #endif
181    unlink(pid_file);    unlink(pid_file);
182    if (!recoverable) {    if (recoverable != 1) {
183      bg_send_quit(BG_ABORT);      bg_send_quit(BG_ABORT);
184      exit(1);      exit(!recoverable);
185    }    }
186  }  }
187    
# Line 381  static void got_fpe(int z) Line 379  static void got_fpe(int z)
379    
380  static void got_term(int z)  static void got_term(int z)
381  {  {
382    write_userfile(-1);    /* Now we die by default on sigterm, but scripts have the chance to
383    check_tcl_event("sigterm");     * catch the event themselves and cancel shutdown by returning 1
384    if (die_on_sigterm) {     */
385      botnet_send_chat(-1, botnetnick, "ACK, I've been terminated!");    if (check_tcl_event("sigterm"))
386      fatal("TERMINATE SIGNAL -- SIGNING OFF", 0);      return;
387    } else    kill_bot("ACK, I've been terminated!", "TERMINATE SIGNAL -- SIGNING OFF");
     putlog(LOG_MISC, "*", "RECEIVED TERMINATE SIGNAL (IGNORING)");  
388  }  }
389    
390  static void got_quit(int z)  static void got_quit(int z)
391  {  {
392    check_tcl_event("sigquit");    if (check_tcl_event("sigquit"))
393    putlog(LOG_MISC, "*", "RECEIVED QUIT SIGNAL (IGNORING)");      return;
394      putlog(LOG_MISC, "*", "Received QUIT signal: restarting...");
395      do_restart = -1;
396    return;    return;
397  }  }
398    
399  static void got_hup(int z)  static void got_hup(int z)
400  {  {
401    write_userfile(-1);    write_userfile(-1);
402    check_tcl_event("sighup");    if (check_tcl_event("sighup"))
403    if (die_on_sighup) {      return;
     fatal("HANGUP SIGNAL -- SIGNING OFF", 0);  
   } else  
404      putlog(LOG_MISC, "*", "Received HUP signal: rehashing...");      putlog(LOG_MISC, "*", "Received HUP signal: rehashing...");
405    do_restart = -2;    do_restart = -2;
406    return;    return;

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23