Changeset 1855
- Timestamp:
- 22/09/2007 00:52:08 (16 months ago)
- Location:
- box/chris/general
- Files:
-
- 6 modified
-
bin/bbackupd/BackupDaemon.cpp (modified) (2 diffs)
-
bin/bbackupd/BackupDaemon.h (modified) (1 diff)
-
bin/bbstored/BackupStoreDaemon.cpp (modified) (1 diff)
-
bin/bbstored/BackupStoreDaemon.h (modified) (1 diff)
-
lib/server/Daemon.cpp (modified) (10 diffs)
-
lib/server/Daemon.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
box/chris/general/bin/bbackupd/BackupDaemon.cpp
r1854 r1855 38 38 #include <process.h> 39 39 #endif 40 41 #include <iostream> 40 42 41 43 #include "Configuration.h" … … 210 212 // 211 213 // -------------------------------------------------------------------------- 212 const char *BackupDaemon::DaemonBanner() const 213 { 214 #ifndef NDEBUG 215 // Don't display banner in debug builds 216 return 0; 217 #else 214 std::string BackupDaemon::DaemonBanner() const 215 { 218 216 return BANNER_TEXT("Backup Client"); 217 } 218 219 void BackupDaemon::Usage() 220 { 221 this->Daemon::Usage(); 222 223 #ifdef WIN32 224 std::cout << 225 " -s Run as a Windows Service, for internal use only\n" 226 " -i Install Windows Service (you may want to specify a config file)\n" 227 " -r Remove Windows Service\n" 228 " -S <name> Service name for -i and -r options\n"; 219 229 #endif 220 230 } -
box/chris/general/bin/bbackupd/BackupDaemon.h
r1854 r1855 70 70 void Run(); 71 71 virtual const char *DaemonName() const; 72 virtual const char *DaemonBanner() const; 72 virtual std::string DaemonBanner() const; 73 virtual void Usage(); 73 74 const ConfigurationVerify *GetConfigVerify() const; 74 75 -
box/chris/general/bin/bbstored/BackupStoreDaemon.cpp
r1784 r1855 94 94 // 95 95 // -------------------------------------------------------------------------- 96 const char *BackupStoreDaemon::DaemonBanner() const 97 { 98 #ifndef NDEBUG 99 // Don't display banner in debug builds 100 return 0; 101 #else 96 std::string BackupStoreDaemon::DaemonBanner() const 97 { 102 98 return BANNER_TEXT("Backup Store Server"); 103 #endif104 99 } 105 100 -
box/chris/general/bin/bbstored/BackupStoreDaemon.h
r1381 r1855 57 57 58 58 virtual const char *DaemonName() const; 59 virtual const char *DaemonBanner() const;59 virtual std::string DaemonBanner() const; 60 60 61 61 const ConfigurationVerify *GetConfigVerify() const; -
box/chris/general/lib/server/Daemon.cpp
r1850 r1855 23 23 #include <ws2tcpip.h> 24 24 #endif 25 26 #include <iostream> 25 27 26 28 #include "Daemon.h" … … 52 54 mRunInForeground(false), 53 55 mKeepConsoleOpenAfterFork(false), 54 mHaveConfigFile(false) 56 mHaveConfigFile(false), 57 mAppName(DaemonName()) 55 58 { 56 59 if(spDaemon != NULL) … … 100 103 std::string Daemon::GetOptionString() 101 104 { 102 return "c:DFqvVt:Tk"; 105 return "c:" 106 #ifndef WIN32 107 "DFk" 108 #endif 109 "hqvVt:T"; 110 } 111 112 void Daemon::Usage() 113 { 114 std::cout << 115 DaemonBanner() << "\n" 116 "\n" 117 "Usage: " << mAppName << " [options] [config file]\n" << 118 "\n" 119 "Options:\n" 120 " -c <file> Use the specified configuration file. If -c is omitted, the last\n" 121 " argument is the configuration file\n" 122 #ifndef WIN32 123 " -D Debugging mode, do not fork, one process only, one client only\n" 124 " -F Do not fork into background, but fork to serve multiple clients\n" 125 " -k Keep console open after fork, keep writing log messages to it\n" 126 #endif 127 " -q Run more quietly, reduce verbosity level by one, can repeat\n" 128 " -v Run more verbosely, increase verbosity level by one, can repeat\n" 129 " -V Run at maximum verbosity\n" 130 " -t <tag> Tag console output with specified marker\n" 131 " -T Timestamp console output\n"; 103 132 } 104 133 … … 125 154 break; 126 155 156 #ifndef WIN32 127 157 case 'D': 128 158 { … … 134 164 { 135 165 mRunInForeground = true; 166 } 167 break; 168 169 case 'k': 170 { 171 mKeepConsoleOpenAfterFork = true; 172 } 173 break; 174 #endif 175 176 case 'h': 177 { 178 Usage(); 179 return 2; 136 180 } 137 181 break; … … 181 225 break; 182 226 183 case 'k':184 {185 mKeepConsoleOpenAfterFork = true;186 }187 break;188 189 227 case '?': 190 228 { … … 220 258 // Find filename of config file 221 259 mConfigFileName = DefaultConfigFile; 260 mAppName = argv[0]; 222 261 223 262 #ifdef NDEBUG … … 226 265 mLogLevel = Log::INFO; // need an int to do math with 227 266 #endif 267 268 if (argc == 2 && strcmp(argv[1], "/?") == 0) 269 { 270 Usage(); 271 return 2; 272 } 228 273 229 274 signed int c; … … 284 329 // Banner (optional) 285 330 { 286 const char *banner = DaemonBanner(); 287 if(banner != 0) 288 { 289 BOX_NOTICE(banner); 290 } 331 #ifndef NDEBUG 332 BOX_NOTICE(DaemonBanner()); 333 #endif 291 334 } 292 335 … … 672 715 // 673 716 // -------------------------------------------------------------------------- 674 const char *Daemon::DaemonBanner() const675 { 676 return 0;717 std::string Daemon::DaemonBanner() const 718 { 719 return "Generic daemon using the Box Application Framework"; 677 720 } 678 721 -
box/chris/general/lib/server/Daemon.h
r1852 r1855 51 51 52 52 virtual const char *DaemonName() const; 53 virtual const char *DaemonBanner() const;53 virtual std::string DaemonBanner() const; 54 54 virtual const ConfigurationVerify *GetConfigVerify() const; 55 virtual void Usage(); 55 56 56 57 bool StopRun() {return mReloadConfigWanted | mTerminateWanted;} … … 88 89 int mLogLevel; // need an int to do math with 89 90 static Daemon *spDaemon; 91 std::string mAppName; 90 92 }; 91 93
