updated on Sat Jan 21 04:00:54 UTC 2012
[aur-mirror.git] / mongodb-stable-git / mongodb.rc
blobaabb0f2b7240e4f867899d2b3db37271d7537575
1 #!/bin/bash
2 # vim: syntax=sh
4 . /etc/rc.conf
5 . /etc/rc.d/functions
7 PID=`pidof /usr/bin/mongod`
8 case "$1" in
9 start)
10 stat_busy "Starting mongod"
11 [ -z "$PID" ] && /bin/su mongodb -s /bin/sh -c "/usr/bin/mongod --config /etc/mongodb.conf run &" > /var/log/mongod 2>&1
12 if [ $? -gt 0 ] ; then
13 stat_fail
14 else
15 add_daemon mongodb
16 stat_done
19 stop)
20 stat_busy "Stopping mongod"
21 [ ! -z "$PID" ] && kill $PID &> /dev/null
22 if [ $? -gt 0 ] ; then
23 stat_fail
24 else
25 #wait for the server to finish shutting down
26 while [ -n "$(pidof /usr/bin/mongod)" ] ; do
27 sleep 1
28 done
29 rm_daemon mongodb
30 stat_done
33 restart)
34 $0 stop
35 $0 start
38 echo "usage: $0 {start|stop|restart}"
39 esac
40 exit 0