File: init.d-mongod
The problem occurs when the contents of the $CONFIGFILE does not contain a reference to pidfilepath. In this case, the parsing results in a null string value for PIDFILEPATH. The if-statement that uses PIDFILEPATH does not quote the variable and so the if-statement will evaluate to true even though there is obviously no such 'null' file.
This was observed when running
service mongod start
resulting in the error
Error starting mongod. exists.
Surrounding the PIDFILEPATH in quotes should fix the problem:
if [ -f "$PIDFILEPATH" ];
then echo "Error starting mongod. $PIDFILEPATH exists."
RETVAL=1
return
fi
The documentation states that the pidfilepath is not required: "Without a specified processManagement.pidFilePath option, the process creates no PID file."
Appears to be resulting from the changes made in SERVER-12048
- related to
-
SERVER-12048 Calling "service mongod start" with mongod running prevents "service mongod stop" from working
- Closed