Ignore:
Timestamp:
22/09/2007 00:05:25 (5 years ago)
Author:
chris
Message:

Use Daemon's delegated option processing instead of our own hacks.

Move Windows service startup, installation and removal to BackupDaemon?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/chris/general/bin/bbackupd/bbackupd.cpp

    r1813 r1854  
    3636#ifdef WIN32 
    3737 
    38         if(argc == 2 && 
    39                 (::strcmp(argv[1], "--help") == 0 || 
    40                  ::strcmp(argv[1], "-h") == 0)) 
    41         { 
    42                 printf("-h help, -i install service, -r remove service,\n" 
    43                         "-c <config file> start daemon now"); 
    44                 return 2; 
    45         } 
    46         if(argc == 2 && ::strcmp(argv[1], "-r") == 0) 
    47         { 
    48                 return RemoveService(); 
    49         } 
    50         if((argc == 2 || argc == 3) && ::strcmp(argv[1], "-i") == 0) 
    51         { 
    52                 const char* config = NULL; 
    53                 if (argc == 3) 
    54                 { 
    55                         config = argv[2]; 
    56                 } 
    57                 return InstallService(config); 
    58         } 
    59  
    60         bool runAsWin32Service = false; 
    61         if (argc >= 2 && ::strcmp(argv[1], "--service") == 0) 
    62         { 
    63                 runAsWin32Service = true; 
    64         } 
     38        EnableBackupRights(); 
    6539 
    6640        gpDaemonService = new Win32BackupService(); 
    67  
    68         EnableBackupRights(); 
    69  
    70         if (runAsWin32Service) 
    71         { 
    72                 BOX_INFO("Box Backup service starting"); 
    73  
    74                 char* config = NULL; 
    75                 if (argc >= 3) 
    76                 { 
    77                         config = strdup(argv[2]); 
    78                 } 
    79  
    80                 ExitCode = OurService(config); 
    81  
    82                 if (config) 
    83                 { 
    84                         free(config); 
    85                 } 
    86  
    87                 BOX_INFO("Box Backup service shut down"); 
    88         } 
    89         else 
    90         { 
    91                 ExitCode = gpDaemonService->Main( 
    92                         BOX_GET_DEFAULT_BBACKUPD_CONFIG_FILE, argc, argv); 
    93         } 
    94  
     41        ExitCode = gpDaemonService->Daemon::Main( 
     42                BOX_GET_DEFAULT_BBACKUPD_CONFIG_FILE, 
     43                argc, argv); 
    9544        delete gpDaemonService; 
    9645 
Note: See TracChangeset for help on using the changeset viewer.