summaryrefslogtreecommitdiff
path: root/rpm/init.d-mongod
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-12-03 14:20:35 -0500
committerEliot Horowitz <eliot@10gen.com>2009-12-03 14:20:35 -0500
commit39b64ce9f3e2093f98431421f0bca00e016107bb (patch)
tree9bd8e726881f36fa295200857e6c3a036e1e1fea /rpm/init.d-mongod
parentec49006e35e929b83459f4668463d4bb3f6e2189 (diff)
downloadmongo-39b64ce9f3e2093f98431421f0bca00e016107bb.tar.gz
initial stab at rpm files SERVER-396
Diffstat (limited to 'rpm/init.d-mongod')
-rw-r--r--rpm/init.d-mongod63
1 files changed, 63 insertions, 0 deletions
diff --git a/rpm/init.d-mongod b/rpm/init.d-mongod
new file mode 100644
index 00000000000..c099ef958d0
--- /dev/null
+++ b/rpm/init.d-mongod
@@ -0,0 +1,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