diff options
author | root <root@rshg047.dnsready.net> | 2011-07-06 23:10:44 +0000 |
---|---|---|
committer | root <root@rshg047.dnsready.net> | 2011-07-06 23:10:44 +0000 |
commit | b215b5e985b9310dff8d992510f12a87141fe7cb (patch) | |
tree | bc81c9c0c02ab9a4d6ee15e553850141b8d46f94 /community-testing/mongodb/mongodb.rc | |
parent | 9d2caacbc33de06407311a5da87e5d22e0266435 (diff) |
Wed Jul 6 23:10:44 UTC 2011
Diffstat (limited to 'community-testing/mongodb/mongodb.rc')
-rwxr-xr-x | community-testing/mongodb/mongodb.rc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/community-testing/mongodb/mongodb.rc b/community-testing/mongodb/mongodb.rc new file mode 100755 index 000000000..517258f63 --- /dev/null +++ b/community-testing/mongodb/mongodb.rc @@ -0,0 +1,39 @@ +#!/bin/bash +# vim: syntax=sh + +. /etc/rc.conf +. /etc/rc.d/functions + +PID=`pidof /usr/bin/mongod` +case "$1" in + start) + stat_busy "Starting mongodb" + [ -z "$PID" ] && /bin/su mongodb -c "/usr/bin/mongod --config /etc/mongodb.conf --fork" > /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon mongodb + stat_done + fi + ;; + stop) + stat_busy "Stopping mongodb" + [ ! -z "$PID" ] && kill $PID &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon mongodb + while [ ! -z "$(pidof /usr/bin/mongod)" ]; do + sleep 1; + done + stat_done + fi + ;; + restart) + $0 stop + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 |