mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-22 19:44:21 +01:00
b46b769505
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
55 lines
769 B
Bash
55 lines
769 B
Bash
#!/bin/sh
|
|
#
|
|
# /etc/rc.d/rc.mongo
|
|
#
|
|
# Start/stop/restart the mongodb server.
|
|
#
|
|
#
|
|
|
|
PID=/var/state/mongodb.pid
|
|
LOG=/var/log/mongodb
|
|
DBPATH=/var/lib/mongodb
|
|
USER=mongo
|
|
GROUP=mongo
|
|
|
|
mongo_start() {
|
|
touch $LOG
|
|
chown $GROUP.$USER $LOG
|
|
touch $PID
|
|
chown $GROUP.$USER $PID
|
|
sudo -u $USER /usr/bin/mongod \
|
|
--dbpath=$DBPATH \
|
|
--fork \
|
|
--pidfilepath=$PID \
|
|
--logappend \
|
|
--logpath=$LOG \
|
|
--nohttpinterface
|
|
}
|
|
|
|
mongo_stop() {
|
|
kill `cat $PID`
|
|
# rm $PID
|
|
}
|
|
|
|
mongo_restart() {
|
|
mongo_stop
|
|
sleep 2
|
|
mongo_start
|
|
}
|
|
|
|
case "$1" in
|
|
'start')
|
|
mongo_start
|
|
;;
|
|
'stop')
|
|
mongo_stop
|
|
;;
|
|
'restart')
|
|
mongo_restart
|
|
;;
|
|
*)
|
|
# Default is "start", for backwards compatibility with previous
|
|
# Slackware versions. This may change to a 'usage' error someday.
|
|
mongo_start
|
|
esac
|
|
|