7 # description: mongod is a cache daemon.
10 # pidfile: /var/run/mongod.pid
14 # Required-Start: $syslog $local_fs $network
15 # Required-Stop: $syslog $local_fs $network
16 # Should-Start: $remote_fs
17 # Should-Stop: $remote_fs
18 # Default-Start: 3 4 5
19 # Default-Stop: 0 1 2 6
20 # Short-Description: MongoDB server
21 # Description: Starts and stops the MongoDB daemon
24 # Source function library
25 . /etc/rc.d/init.d/functions
28 . /etc/sysconfig/network
30 # Check that networking is up.
31 if is_yes "${NETWORKING}"; then
32 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
33 msg_network_down "mongod"
40 MONGOD_BIN="/usr/bin/mongod"
41 MONGOD_LOGFILE="/var/log/mongo/mongod.log"
42 MONGOD_PIDFILE="/var/run/mongod.pid"
43 MONGOD_CONFIG="/etc/sysconfig/mongod"
49 [ -f /etc/sysconfig/mongod ] && . /etc/sysconfig/mongod
52 # Check if the service is already running?
53 if [ -f /var/lock/subsys/mongod ]; then
54 msg_already_running "mongod"
59 daemon --pidfile $MONGOD_PIDFILE --user $MONGOD_USER \
60 $MONGOD_BIN --config /etc/mongod.conf run
62 [ $ret = 0 ] || RETVAL=$?
63 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/mongod
67 if [ ! -f /var/lock/subsys/mongod ]; then
68 msg_not_running "mongod"
73 killproc --pidfile $MONGOD_PIDFILE mongod
74 rm -f /var/lock/subsys/mongod >/dev/null 2>&1
78 if [ ! -f /var/lock/subsys/mongod ]; then
79 msg_not_running "mongod"
89 if [ ! -f /var/lock/subsys/mongod ]; then
90 msg_not_running "mongod"
95 msg_reloading "mongod"
96 killproc --pidfile $MONGOD_PIDFILE mongod -HUP
100 # See how we were called.
123 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"