mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-26 22:06:35 +01:00
67d04ea4e2
Signed-off-by: Niels Horn <niels.horn@slackbuilds.org>
49 lines
658 B
Bash
49 lines
658 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
|
|
|
|
mongo_start() {
|
|
mkdir -p $DBPATH
|
|
/usr/bin/mongod \
|
|
--dbpath=$DBPATH \
|
|
--fork \
|
|
--pidfilepath=$PID \
|
|
--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
|
|
|