0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 09:06:21 +01:00

configurable windows service name SERVER-967

This commit is contained in:
Eliot Horowitz 2010-04-05 20:22:33 -04:00
parent 5b2e9fdad3
commit 653e98cd64

View File

@ -64,6 +64,10 @@ namespace mongo {
extern string repairpath;
#if defined(_WIN32)
string windowsServiceName = "MongoDB";
#endif
void setupSignals();
void closeAllSockets();
void startReplication();
@ -662,6 +666,7 @@ int main(int argc, char* argv[], char *envp[] )
("install", "install mongodb service")
("remove", "remove mongodb service")
("service", "start mongodb service")
("serviceName", po::value<string>(&windowsServiceName), "windows service name")
#else
("nounixsocket", "disable listening on unix sockets")
#endif
@ -955,17 +960,17 @@ int main(int argc, char* argv[], char *envp[] )
#if defined(_WIN32)
if ( installService ) {
if ( !ServiceController::installService( L"MongoDB", L"Mongo DB", L"Mongo DB Server", argc, argv ) )
if ( !ServiceController::installService( windowsServiceName.c_str() , L"Mongo DB", L"Mongo DB Server", argc, argv ) )
dbexit( EXIT_NTSERVICE_ERROR );
dbexit( EXIT_CLEAN );
}
else if ( removeService ) {
if ( !ServiceController::removeService( L"MongoDB" ) )
if ( !ServiceController::removeService( windowsServiceName.c_str() ) )
dbexit( EXIT_NTSERVICE_ERROR );
dbexit( EXIT_CLEAN );
}
else if ( startService ) {
if ( !ServiceController::startService( L"MongoDB", mongo::initService ) )
if ( !ServiceController::startService( windowsServiceName.c_str() , mongo::initService ) )
dbexit( EXIT_NTSERVICE_ERROR );
dbexit( EXIT_CLEAN );
}