-
Notifications
You must be signed in to change notification settings - Fork 0
/
mongodb
executable file
·44 lines (41 loc) · 1.14 KB
/
mongodb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
### BEGIN INIT INFO
# Provides: mongodb
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: mongodb
# Description: mongo db server
### END INIT INFO
. /lib/lsb/init-functions
PROGRAM=/opt/mongodb/bin/mongod
MONGOPID=`ps -ef | grep $PROGRAM | grep -v grep | awk '{print $2}'`
test -x $PROGRAM || exit 0
case "$1" in
start)
log_begin_msg "Starting MongoDB server"
$PROGRAM --fork --quiet -journal -maxConns=2400 -rest --httpinterface --logpath /data/db/journal/mongdb.log
log_end_msg 0
;;
stop)
log_begin_msg "Stopping MongoDB server"
if [[ -n "$MONGOPID" ]]; then
kill -15 $MONGOPID
fi
log_end_msg 0
;;
status)
if [[ -n "$MONGOPID" ]]; then
log_begin_msg "mongod is running with the pid: $MONGOPID"
log_end_msg 0
else
log_failure_msg "mongod is not running"
fi
;;
*)
log_success_msg "Usage: /etc/init.d/mongodb {start|stop|status}"
exit 1
;;
esac
exit 0