[SERVER-2267] RPM init script hard codes path of pid file which will change if user specifies new data directory Created: 21/Dec/10  Updated: 12/Jul/16  Resolved: 18/Feb/12

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: 1.6.5
Fix Version/s: 2.1.1

Type: Improvement Priority: Minor - P4
Reporter: Michael Spiegle Assignee: Michael A. Fiedler
Resolution: Done Votes: 3
Labels: initscript, packaging
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Redhat Enterprise 5.4


Issue Links:
Depends
Related
related to SERVER-16731 Remove unused DBPATH init script vari... Closed
Backwards Compatibility: Fully Compatible
Participants:

 Description   

The init script supplied does not stop the server in some environments because killproc() in the stop() section hard-codes the path of the PID file. If the user specifies a new 'dbpath' in /etc/mongod.conf, then the PID file will be placed there instead, and killproc won't find it.



 Comments   
Comment by auto [ 18/Feb/12 ]

Author:

{u'login': u'miketheman', u'name': u'Mike Fiedler', u'email': u'miketheman@gmail.com'}

Message: Merge pull request #180 from miketheman/SERVER-2267-changelog

updating rpm changelog for SERVER-2267
Branch: master
https://github.com/mongodb/mongo/commit/f06e7dc332a694ed3b344c360338b2a18814db2b

Comment by auto [ 18/Feb/12 ]

Author:

{u'login': u'miketheman', u'name': u'Mike Fiedler', u'email': u'miketheman@gmail.com'}

Message: Merge pull request #180 from miketheman/SERVER-2267-changelog

updating rpm changelog for SERVER-2267
Branch: master
https://github.com/mongodb/mongo/commit/f06e7dc332a694ed3b344c360338b2a18814db2b

Comment by auto [ 18/Feb/12 ]

Author:

{u'login': u'miketheman', u'name': u'Mike Fiedler', u'email': u'miketheman@gmail.com'}

Message: updating rpm changelog for SERVER-2267
Branch: master
https://github.com/mongodb/mongo/commit/c9787e73033e167789d8fec94cc8617227b84d33

Comment by Michael A. Fiedler [ 18/Feb/12 ]

This has been resolved in the current branch of mongodb 2.1.x.
The change is slightly different than described by Tilo above, in that we now use the --pidfilepath argument to create the PID file in /var/run/mongo/mongod.pid, rather than rely on the contents of the mongod.lock file.
In most scenarios, the lock file may contain the pid of the process anyways, but this is a bad practice to rely on.

Comment by auto [ 18/Feb/12 ]

Author:

{u'login': u'miketheman', u'name': u'Mike Fiedler', u'email': u'miketheman@gmail.com'}

Message: Merge pull request #179 from miketheman/SERVER-2267-init-pid

SERVER-2267 init pid
Branch: master
https://github.com/mongodb/mongo/commit/b76fd75476efbbcc9acc8bcedac00ec4d28ab088

Comment by auto [ 18/Feb/12 ]

Author:

{u'login': u'miketheman', u'name': u'Mike Fiedler', u'email': u'miketheman@gmail.com'}

Message: Merge pull request #179 from miketheman/SERVER-2267-init-pid

SERVER-2267 init pid
Branch: master
https://github.com/mongodb/mongo/commit/b76fd75476efbbcc9acc8bcedac00ec4d28ab088

Comment by auto [ 18/Feb/12 ]

Author:

{u'login': u'miketheman', u'name': u'Mike Fiedler', u'email': u'miketheman@gmail.com'}

Message: Merge branch 'master' of git://github.com/mongodb/mongo into SERVER-2267-init-pid
Branch: master
https://github.com/mongodb/mongo/commit/673d220faadc3669f00b49cac1faa5d14bbfde72

Comment by Puneet Kandhari [ 23/Jan/12 ]

Will this be fixed as part of 2.* releases ?

Comment by Tilo S [ 02/Apr/11 ]

NOTE:

I observed this problem on Fedora 13 and Fedora 14

Comment by Tilo S [ 02/Apr/11 ]

here's the BUGFIX for this:

in the top section of the script, add these two lines:

MONGO_DBPATH=`/bin/grep '^dbpath' /etc/mongod.conf | /bin/cut -d'=' -f2` # grep for the dbpath in the config file
MONGO_LOCKFILE="$MONGO_DBPATH/mongod.lock"

and replace the line with the killproc statement as follows:

  1. killproc -p /var/lib/mongo/mongod.lock -t30 -TERM /usr/bin/mongod
    killproc -p $MONGO_LOCKFILE -t30 -TERM /usr/bin/mongod

this should do the trick! works for me..

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