summaryrefslogtreecommitdiff
path: root/rpm
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-07-31 11:54:33 -0400
commit50ca596ace0b1390482408f1b19ffb1f9170cab6 (patch)
tree6e40889f92dd2665aa9597d4e9e8488a9cd4c9c3 /rpm
parentb494ade9a9461d16ab3812640ca72ee9c9e4345c (diff)
downloadmongo-50ca596ace0b1390482408f1b19ffb1f9170cab6.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>
Diffstat (limited to 'rpm')
-rw-r--r--rpm/init.d-mongod6
1 files changed, 6 insertions, 0 deletions
diff --git a/rpm/init.d-mongod b/rpm/init.d-mongod
index 0a0114403f4..3d27fc8f29e 100644
--- a/rpm/init.d-mongod
+++ b/rpm/init.d-mongod
@@ -24,6 +24,7 @@ SYSCONFIG="/etc/sysconfig/mongod"
# for now. This can go away when this script stops supporting 1.8.
DBPATH=`awk -F'[:=]' -v IGNORECASE=1 '/^[[:blank:]]*dbpath[[:blank:]]*[:=][[:blank:]]*/{print $2}' "$CONFIGFILE" | tr -d '[:blank:]'`
PIDFILEPATH=`awk -F'[:=]' -v IGNORECASE=1 '/^[[:blank:]]*pidfilepath[[:blank:]]*[:=][[:blank:]]*/{print $2}' "$CONFIGFILE" | tr -d '[:blank:]'`
+PIDDIR=`dirname $PIDFILEPATH`
mongod=${MONGOD-/usr/bin/mongod}
@@ -46,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
#