summaryrefslogtreecommitdiff
path: root/rpm/init.d-mongod
blob: c099ef958d08214ef337e070004f8f83d78ae221 (plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash

# mongod - Startup script for mongod

# chkconfig: 35 85 15
# description: Mongo is a scalable, document-oriented database.
# processname: mongod
# config: /etc/mongod.conf
# pidfile: /var/run/mongo/mongo.pid

. /etc/rc.d/init.d/functions

# things from mongod.conf get there by mongod reading it

OPTIONS=" -f /etc/mongod.conf"

mongod=${MONGOD-/usr/bin/mongod}
pidfile=${PIDFILE-/var/run/mongod.pid}
lockfile=${LOCKFILE-/var/lock/subsys/mongod}

start()
{
  echo -n $"Starting mongod: "
  #daemon --pidfile=${pidfile} $mongod $OPTIONS  > /var/log/mongod
  $mongod $OPTIONS > /var/log/mongod 2>&1 &
  RETVAL=$?
  [ $RETVAL = 0 ] && touch ${lockfile}
  echo OK
}

stop()
{
  echo -n $"Stopping mongod: "
  #killproc -p ${pidfile} -d 10 $mongod
  #RETVAL=$?
  killall mongod > /dev/null 2>&1 
  #[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
  echo OK
}

ulimit -n 12000
RETVAL=0

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
    stop
    start
    ;;
#  status)
#    status -p ${pidfile} $mongod
#    ;;
  *)
    echo $"Usage: $0 {start|stop|restart}"
    RETVAL=1
esac

exit $RETVAL