updated on Fri Jan 20 00:01:56 UTC 2012
[aur-mirror.git] / mongodb-dev / mongodb.rc
blob6f0d0fbe278875e6eb04a8d43902f1f1669ef040
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 mongodb"
11 [ -z "$PID" ] && /bin/su mongodb -c "/usr/bin/mongod --config /etc/mongodb.conf &" > /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 mongodb"
21 [ ! -z "$PID" ] && kill $PID &> /dev/null
22 if [ $? -gt 0 ]; then
23 stat_fail
24 else
25 rm_daemon mongodb
26 while [ ! -z "$(pidof /usr/bin/mongod)" ]; do
27 sleep 1;
28 done
29 stat_done
32 restart)
33 $0 stop
34 $0 start
37 echo "usage: $0 {start|stop|restart}"
38 esac
39 exit 0