summaryrefslogtreecommitdiff
path: root/bin/bbackupd/bbackupd.cpp
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2006-08-09 17:27:46 +0000
committerChris Wilson <chris+github@qwirx.com>2006-08-09 17:27:46 +0000
commitbec6ea866b973c9661b4b2d4a7d342fa0a075185 (patch)
treed15ccb961e88018f7b23da269920de9c0274fdd3 /bin/bbackupd/bbackupd.cpp
parent52dfab19cd69b6423af80c7276caa5b65fdd6545 (diff)
* bin/bbackupd/Win32ServiceFunctions.h
* bin/bbackupd/Win32ServiceFunctions.cpp - InstallService() and OurService() take the config file name as a parameter - InstallService() returns an integer status code like RemoveService() - OurService() sets the global static config file name to pass into the main thread later * bin/bbackupd/bbackupd.cpp - Call InstallService() and OurService() with the config file name as a parameter
Diffstat (limited to 'bin/bbackupd/bbackupd.cpp')
-rw-r--r--bin/bbackupd/bbackupd.cpp29
1 files changed, 24 insertions, 5 deletions
diff --git a/bin/bbackupd/bbackupd.cpp b/bin/bbackupd/bbackupd.cpp
index 089b2d09..d2279074 100644
--- a/bin/bbackupd/bbackupd.cpp
+++ b/bin/bbackupd/bbackupd.cpp
@@ -43,14 +43,19 @@ int main(int argc, const char *argv[])
RemoveService();
return 0;
}
- if(argc == 2 && ::strcmp(argv[1], "-i") == 0)
+ if((argc == 2 || argc == 3) && ::strcmp(argv[1], "-i") == 0)
{
- InstallService();
+ const char* config = NULL;
+ if (argc == 3)
+ {
+ config = argv[2];
+ }
+ InstallService(config);
return 0;
}
bool runAsWin32Service = false;
- if (argc == 2 && ::strcmp(argv[1], "--service") == 0)
+ if (argc >= 2 && ::strcmp(argv[1], "--service") == 0)
{
runAsWin32Service = true;
}
@@ -73,8 +78,22 @@ int main(int argc, const char *argv[])
if (runAsWin32Service)
{
- syslog(LOG_INFO,"Starting Box Backup Service");
- OurService();
+ syslog(LOG_INFO, "Box Backup service starting");
+
+ char* config = NULL;
+ if (argc >= 3)
+ {
+ config = strdup(argv[2]);
+ }
+
+ OurService(config);
+
+ if (config)
+ {
+ free(config);
+ }
+
+ syslog(LOG_INFO, "Box Backup service shut down");
}
else
{