summaryrefslogtreecommitdiff
path: root/system/mongodb/rc.mongodb
diff options
context:
space:
mode:
authorMiguel De Anda <miguel@thedeanda.com>2017-10-19 20:42:02 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2017-10-19 20:42:02 +0700
commit71c7c3f01f7975a02faf4d50c02ab031af3f6081 (patch)
tree97915bc261cd7dc40e51451c3e32a492dd5bec5d /system/mongodb/rc.mongodb
parent1d0a4b9a1936e80584572aa26ca4e9fca1b062b7 (diff)
downloadslackbuilds-71c7c3f01f7975a02faf4d50c02ab031af3f6081.tar.gz
system/mongodb: Updated for version 3.4.9.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
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
}