Changeset 1854 for box/chris/general/bin/bbackupd/BackupDaemon.cpp
- Timestamp:
- 22/09/2007 00:05:25 (5 years ago)
- File:
-
- 1 edited
-
box/chris/general/bin/bbackupd/BackupDaemon.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
box/chris/general/bin/bbackupd/BackupDaemon.cpp
r1831 r1854 77 77 #include "autogen_ClientException.h" 78 78 79 #ifdef WIN32 80 #include "Win32ServiceFunctions.h" 81 #include "Win32BackupService.h" 82 83 extern Win32BackupService* gpDaemonService; 84 #endif 85 79 86 #include "MemLeakFindOn.h" 80 87 … … 117 124 mDeleteUnusedRootDirEntriesAfter(0), 118 125 mLogAllFileAccess(false) 126 #ifdef WIN32 127 , mInstallService(false), 128 mRemoveService(false), 129 mRunAsService(false) 130 #endif 119 131 { 120 132 // Only ever one instance of a daemon … … 277 289 278 290 #ifdef WIN32 291 std::string BackupDaemon::GetOptionString() 292 { 293 std::string oldOpts = this->Daemon::GetOptionString(); 294 ASSERT(oldOpts.find("s") == std::string::npos); 295 ASSERT(oldOpts.find("S") == std::string::npos); 296 ASSERT(oldOpts.find("i") == std::string::npos); 297 ASSERT(oldOpts.find("r") == std::string::npos); 298 return oldOpts + "sS:ir"; 299 } 300 301 int BackupDaemon::ProcessOption(signed int option) 302 { 303 switch(option) 304 { 305 case 's': 306 { 307 mRunAsService = true; 308 return 0; 309 } 310 311 case 'S': 312 { 313 mServiceName = optarg; 314 return 0; 315 } 316 317 case 'i': 318 { 319 mInstallService = true; 320 return 0; 321 } 322 323 case 'r': 324 { 325 mRemoveService = true; 326 return 0; 327 } 328 329 default: 330 { 331 return this->Daemon::ProcessOption(option); 332 } 333 } 334 } 335 336 int BackupDaemon::Main(const std::string &rConfigFileName) 337 { 338 if (mInstallService) 339 { 340 return InstallService(rConfigFileName.c_str()); 341 } 342 343 if (mRemoveService) 344 { 345 return RemoveService(); 346 } 347 348 int returnCode; 349 350 if (mRunAsService) 351 { 352 // We will be called reentrantly by the Service Control 353 // Manager, and we had better not call OurService again! 354 mRunAsService = false; 355 356 BOX_INFO("Box Backup service starting"); 357 returnCode = OurService(rConfigFileName.c_str()); 358 BOX_INFO("Box Backup service shut down"); 359 } 360 else 361 { 362 returnCode = this->Daemon::Main(rConfigFileName); 363 } 364 365 return returnCode; 366 } 367 279 368 void BackupDaemon::RunHelperThread(void) 280 369 {
Note: See TracChangeset
for help on using the changeset viewer.
