[SERVER-1877] Using single hyphen for install parameter will install un-startable Windows service Created: 30/Sep/10  Updated: 12/Jul/16  Resolved: 06/May/12

Status: Closed
Project: Core Server
Component/s: Admin
Affects Version/s: 1.6.1, 1.6.3
Fix Version/s: 2.1.2

Type: Bug Priority: Major - P3
Reporter: Matt Smith Assignee: Tad Marshall
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 2008 Server R2


Operating System: Windows
Participants:

 Description   

When installing MongoDB as a Windows service with a single hyphen before the "install" parameter, the Windows service will be created. However, when attempting to start the service, the service will fail to start. Alternatively, if you install using two hyphens before the "install" parameter, the service will start just fine.

For example, this will create a Windows service that cannot be started:
> "C:\Program Files\MongoDB\bin\mongod.exe" -install --logpath "C:\MongoLog.txt"

This will create a Windows service that CAN be started (notice the two hyphens before "install"):
> "C:\Program Files\MongoDB\bin\mongod.exe" --install --logpath "C:\MongoLog.txt"



 Comments   
Comment by auto [ 06/May/12 ]

Author:

{u'login': u'tadmarshall', u'name': u'Tad Marshall', u'email': u'tad@10gen.com'}

Message: SERVER-1877 accept Windows service options with single dash

Because we use allow_long_disguise in our style for
boost::program_options parsing (to make -vvvvv work) we will
accept "-install" and "--install" and likewise for all options.
This means that when parsing option-by-option as we do in
util/ntservice.cpp, we need to handle both "-" and "--" prefixes.
Branch: master
https://github.com/mongodb/mongo/commit/1ea09fe1acb0592c1d63a91a8655bb51b1f65085

Comment by Tad Marshall [ 31/Jan/12 ]

It's true. Apparently, the -install switch is "recognized" as the --install switch when checking to see if we should install the service, but is "not recognized" by the code that would change it to --service. So, we set up the service's command line including the bogus -install switch and not including the --service switch that would make it work correctly.

Generated at Thu Feb 08 02:58:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.