summaryrefslogtreecommitdiff
path: root/bin/bbackupd/bbackupd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'bin/bbackupd/bbackupd.cpp')
-rw-r--r--bin/bbackupd/bbackupd.cpp59
1 files changed, 4 insertions, 55 deletions
diff --git a/bin/bbackupd/bbackupd.cpp b/bin/bbackupd/bbackupd.cpp
index e094d499..a0f275b3 100644
--- a/bin/bbackupd/bbackupd.cpp
+++ b/bin/bbackupd/bbackupd.cpp
@@ -35,63 +35,12 @@ int main(int argc, const char *argv[])
#ifdef WIN32
- if(argc == 2 &&
- (::strcmp(argv[1], "--help") == 0 ||
- ::strcmp(argv[1], "-h") == 0))
- {
- printf("-h help, -i install service, -r remove service,\n"
- "-c <config file> start daemon now");
- return 2;
- }
- if(argc == 2 && ::strcmp(argv[1], "-r") == 0)
- {
- return RemoveService();
- }
- if((argc == 2 || argc == 3) && ::strcmp(argv[1], "-i") == 0)
- {
- const char* config = NULL;
- if (argc == 3)
- {
- config = argv[2];
- }
- return InstallService(config);
- }
-
- bool runAsWin32Service = false;
- if (argc >= 2 && ::strcmp(argv[1], "--service") == 0)
- {
- runAsWin32Service = true;
- }
-
- gpDaemonService = new Win32BackupService();
-
EnableBackupRights();
- if (runAsWin32Service)
- {
- BOX_INFO("Box Backup service starting");
-
- char* config = NULL;
- if (argc >= 3)
- {
- config = strdup(argv[2]);
- }
-
- ExitCode = OurService(config);
-
- if (config)
- {
- free(config);
- }
-
- BOX_INFO("Box Backup service shut down");
- }
- else
- {
- ExitCode = gpDaemonService->Main(
- BOX_GET_DEFAULT_BBACKUPD_CONFIG_FILE, argc, argv);
- }
-
+ gpDaemonService = new Win32BackupService();
+ ExitCode = gpDaemonService->Daemon::Main(
+ BOX_GET_DEFAULT_BBACKUPD_CONFIG_FILE,
+ argc, argv);
delete gpDaemonService;
#else // !WIN32