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

Diff of /monit/monitor.c

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

revision 1.115 by chopp, Tue Jul 13 07:03:19 2004 UTC revision 1.116 by hauk, Sun Dec 12 23:45:09 2004 UTC
# Line 66  Line 66 
66  #include "process.h"  #include "process.h"
67  #include "md5.h"  #include "md5.h"
68  #include "sha.h"  #include "sha.h"
69    #include "state.h"
70    
71    
72  /**  /**
73   *  DESCRIPTION   *  DESCRIPTION
# Line 109  static RETSIGTYPE do_wakeup(int);  /* Si Line 111  static RETSIGTYPE do_wakeup(int);  /* Si
111   */   */
112  int main(int argc, char **argv) {  int main(int argc, char **argv) {
113    
114    prog= stripfilename(argv[0]);    prog= Util_basename(argv[0]);
115    init_env();    init_env();
116    handle_options(argc, argv);    handle_options(argc, argv);
117    
# Line 185  static void do_init() { Line 187  static void do_init() {
187     */     */
188    if(! Run.controlfile) {    if(! Run.controlfile) {
189            
190      Run.controlfile= find_rcfile();      Run.controlfile= File_findControlFile();
191            
192    }    }
193        
# Line 239  static void do_init() { Line 241  static void do_init() {
241    /*    /*
242     * Initialize Runtime file variables     * Initialize Runtime file variables
243     */     */
244    init_files();    File_init();
245    
246    /*    /*
247     * Should we print debug information ?     * Should we print debug information ?
248     */     */
249    if(Run.debug) {    if(Run.debug) {
250            
251      printrunlist();      Util_printRunList();
252      printservicelist();      Util_printServiceList();
253            
254    }    }
255    
# Line 295  static void do_reinit() { Line 297  static void do_reinit() {
297    }    }
298        
299    /* Reinitialize Runtime file variables */    /* Reinitialize Runtime file variables */
300    init_files();    File_init();
301    
302    if(! create_pidfile(Run.pidfile)) {    if(! File_createPidFile(Run.pidfile)) {
303      log("%s daemon died\n", prog);      log("%s daemon died\n", prog);
304      exit(1);      exit(1);
305    }    }
306    
307    /* Update service data from the state repository */    /* Update service data from the state repository */
308    state_update();    State_update();
309        
310    /* Start http interface */    /* Start http interface */
311    if(can_http())    if(can_http())
# Line 449  static void do_default() { Line 451  static void do_default() {
451      if(Run.init != TRUE)      if(Run.init != TRUE)
452        daemonize();        daemonize();
453            
454      if(! create_pidfile(Run.pidfile)) {      if(! File_createPidFile(Run.pidfile)) {
455        log("%s daemon died\n", prog);        log("%s daemon died\n", prog);
456        exit(1);        exit(1);
457      }      }
458    
459      if(state_should_update())      if(State_shouldUpdate())
460        state_update();        State_update();
461    
462      atexit(finalize_files);      atexit(File_finalize);
463        
464      if(can_http())      if(can_http())
465        monit_http(START_HTTP);        monit_http(START_HTTP);
# Line 465  static void do_default() { Line 467  static void do_default() {
467      for(;;) {      for(;;) {
468    
469        validate();        validate();
470        state_save();        State_save();
471        sleep(Run.polltime);        sleep(Run.polltime);
472    
473        if(Run.doreload)        if(Run.doreload)
# Line 549  static void handle_options(int argc, cha Line 551  static void handle_options(int argc, cha
551    
552      case 'H':      case 'H':
553          if (argc > optind) {          if (argc > optind) {
554            printhash(argv[optind]);            Util_printHash(argv[optind]);
555          } else {          } else {
556            printhash(NULL);            Util_printHash(NULL);
557          }          }
558                        
559          exit(0);          exit(0);

Legend:
Removed from v.1.115  
changed lines
  Added in v.1.116

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