summaryrefslogtreecommitdiff
path: root/system/mongodb/rc.mongodb
diff options
context:
space:
mode:
Diffstat (limited to 'system/mongodb/rc.mongodb')
-rw-r--r--system/mongodb/rc.mongodb21
1 files changed, 17 insertions, 4 deletions
diff --git a/system/mongodb/rc.mongodb b/system/mongodb/rc.mongodb
index f00cc685c4..47ca19be76 100644
--- a/system/mongodb/rc.mongodb
+++ b/system/mongodb/rc.mongodb
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# /etc/rc.d/rc.mongo
+# /etc/rc.d/rc.mongodb
#
# Start/stop/restart the mongodb server.
#
@@ -11,23 +11,36 @@ LOG=/var/log/mongodb
DBPATH=/var/lib/mongodb
USER=mongo
GROUP=mongo
+SHELL=${SHELL:-/bin/bash}
mongo_start() {
touch $LOG
chown $GROUP.$USER $LOG
touch $PID
chown $GROUP.$USER $PID
- sudo -u $USER /usr/bin/mongod \
+
+ su -l $USER -s $SHELL -c "/usr/bin/mongod \
--dbpath=$DBPATH \
--fork \
--pidfilepath=$PID \
--logappend \
--logpath=$LOG \
- --nohttpinterface
+ --nohttpinterface \
+ " && {
+ echo "MongoDB server started successfully."
+ } || {
+ echo "Failed starting MongoDB server!" > /dev/stderr
+ exit 1
+ }
}
mongo_stop() {
- kill `cat $PID`
+ kill `cat $PID` && {
+ echo "MongoDB server stopped."
+ } || {
+ echo "Failed to stop MongoDB server" > /dev/stderr
+ exit 1
+ }
# rm $PID
}