summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus W. Mahlberg <markus.mahlberg@me.com>2014-07-25 12:09:58 +0200
committerBenety Goh <benety@mongodb.com>2014-09-17 07:38:44 -0400
commitddce701ed775996f2a49fc949e26c5bcbc38fe84 (patch)
tree9794820a726851acda911f524285753fb7da1b1b
parent6b1bbcefe2592f5c1e8ce2ae81ad40fca68c54a0 (diff)
downloadmongo-ddce701ed775996f2a49fc949e26c5bcbc38fe84.tar.gz
SERVER-14679 fixed init.d script to create directory for pid file
Startup scripts not fit for CentOS 7 / RHEL 7 Default location for pid file is under /var/run/mongodb. /var/run can be mounted on a temporary filesystem so the pid file directory is not guaranteed to persist across reboots. Closes #723 Signed-off-by: Benety Goh <benety@mongodb.com> (cherry picked from commit 50ca596ace0b1390482408f1b19ffb1f9170cab6) Conflicts: rpm/init.d-mongod
-rw-r--r--rpm/init.d-mongod7
1 files changed, 7 insertions, 0 deletions
diff --git a/rpm/init.d-mongod b/rpm/init.d-mongod
index 0d7aaa555fc..b227394423d 100644
--- a/rpm/init.d-mongod
+++ b/rpm/init.d-mongod
@@ -24,6 +24,8 @@ SYSCONFIG="/etc/sysconfig/mongod"
# for now. This can go away when this script stops supporting 1.8.
DBPATH=`awk -F= '/^dbpath[[:blank:]]*=[[:blank:]]*/{print $2}' "$CONFIGFILE"`
PIDFILE=`awk -F= '/^pidfilepath[[:blank:]]*=[[:blank:]]*/{print $2}' "$CONFIGFILE"`
+PIDDIR=`dirname $PIDFILE`
+
mongod=${MONGOD-/usr/bin/mongod}
MONGO_USER=mongod
@@ -45,6 +47,11 @@ fi
start()
{
+ # Make sure the default pidfile directory exists
+ if [ ! -d $PIDDIR ]; then
+ install -d -m 0755 -o $MONGO_USER -g $MONGO_GROUP $PIDDIR
+ fi
+
# Recommended ulimit values for mongod or mongos
# See http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings
#