summaryrefslogtreecommitdiff
path: root/rpm/init.d-mongod
diff options
context:
space:
mode:
authorRichard Kreuter <richard@10gen.com>2010-03-16 10:05:32 -0400
committerRichard Kreuter <richard@10gen.com>2010-03-16 10:06:36 -0400
commit2b7eb102159a36129222afa1883ea3b15145e08b (patch)
tree905f5a946ca8b513535996b4aea27ce96e9e6874 /rpm/init.d-mongod
parent38028c6e8fe184dd8a69df35a898e8aaa14d737b (diff)
downloadmongo-2b7eb102159a36129222afa1883ea3b15145e08b.tar.gz
Improve RPM packaging, init scripts. SERVER-575, SERVER-576.
Diffstat (limited to 'rpm/init.d-mongod')
-rw-r--r--rpm/init.d-mongod45
1 files changed, 27 insertions, 18 deletions
diff --git a/rpm/init.d-mongod b/rpm/init.d-mongod
index c099ef958d0..2c634f6aa0c 100644
--- a/rpm/init.d-mongod
+++ b/rpm/init.d-mongod
@@ -12,30 +12,37 @@
# things from mongod.conf get there by mongod reading it
+
+
OPTIONS=" -f /etc/mongod.conf"
+SYSCONFIG="/etc/sysconfig/mongod"
mongod=${MONGOD-/usr/bin/mongod}
-pidfile=${PIDFILE-/var/run/mongod.pid}
-lockfile=${LOCKFILE-/var/lock/subsys/mongod}
+
+MONGO_USER=mongod
+MONGO_GROUP=mongod
+
+. "$SYSCONFIG" || true
start()
{
echo -n $"Starting mongod: "
- #daemon --pidfile=${pidfile} $mongod $OPTIONS > /var/log/mongod
- $mongod $OPTIONS > /var/log/mongod 2>&1 &
+ daemon --user "$MONGO_USER" $mongod $OPTIONS
RETVAL=$?
- [ $RETVAL = 0 ] && touch ${lockfile}
- echo OK
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/mongod && success
}
stop()
{
echo -n $"Stopping mongod: "
- #killproc -p ${pidfile} -d 10 $mongod
- #RETVAL=$?
- killall mongod > /dev/null 2>&1
- #[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
- echo OK
+ killproc -p /var/lib/mongo/mongod.lock -t30 -TERM /usr/bin/mongod
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/mongod &7 success
+}
+
+restart () {
+ stop
+ start
}
ulimit -n 12000
@@ -48,15 +55,17 @@ case "$1" in
stop)
stop
;;
- restart)
- stop
- start
+ restart|reload|force-reload)
+ restart
+ ;;
+ condrestart)
+ [ -f /var/lock/subsys/mongodb ] && restart || :
+ ;;
+ status)
+ status $mongod
;;
-# status)
-# status -p ${pidfile} $mongod
-# ;;
*)
- echo $"Usage: $0 {start|stop|restart}"
+ echo "Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
RETVAL=1
esac