diff options
author | root <root@rshg054.dnsready.net> | 2011-09-13 23:14:39 +0000 |
---|---|---|
committer | root <root@rshg054.dnsready.net> | 2011-09-13 23:14:39 +0000 |
commit | a712dc92423a31a4d3ab34fe660df550feebf442 (patch) | |
tree | ad93851f4343f00cec2f901e4839da01a8b77efe /community-testing/mongodb/mongodb.rc | |
parent | b3a841a1f66eff75be29fba090b83ce4322d4721 (diff) |
Tue Sep 13 23:14:39 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..30f2bbf79 --- /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" ] && /bin/su mongodb -c "/usr/bin/mongod --config /etc/mongodb.conf --shutdown" &> /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 |