In Centos 7.2 (did not test on other versions), if we modify the pidfilepath in the mongod.conf, the mongod service cannot be stopped. The solution was to change the pidfilepath in the /etc/init.d/mongod file.
Steps to reproduce the issue
- Stop mongod if running.
- Change the location of pidfilepath to something else
- Launch mongod
- Stop mongod
It will return OK:
- do a ps -ef | grep mongod. Mongod will still be there running.
- Edit the init.d script or the mongod.conf file so that the pidfilepath matches in both locations.