Created
November 23, 2011 19:24
-
-
Save rtgibbons/1389633 to your computer and use it in GitHub Desktop.
Centos init.d for mms-agent from 10Gen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# /etc/rc.d/init.d/mms-agent | |
# | |
# 10Gen Mongod montiroing service | |
# must edit the settings.py first and edit this file with the location of agent.py | |
# | |
# description: 10Gen monitoring service - need ot fix pid so we can shut it down | |
# chkconfig: - 90 10 | |
# Source function library. | |
. /etc/init.d/functions | |
prog="mms-agent" | |
python="/usr/local/bin/python2.7" | |
agent="/usr/local/lib/mms-agent/agent.py" | |
logfile="/var/log/mongodb/$prog.log" | |
pidfile="/var/run/mongodb/$prog.pid" | |
start() { | |
echo -n "Starting $prog: " | |
daemon --user mongodb --pidfile $pidfile "$python $agent > $logfile 2>&1 &" | |
retval=$? | |
pid=$$ | |
[ $retval -eq 0 ] && touch /var/lock/subsys/$prog | |
return $retval | |
} | |
stop() { | |
#doesn't work at the moment | |
echo -n "Shutting down $prog: " | |
killproc -p $pidfile $prog | |
retval=$? | |
[ $retval -eq 0 ] && rm -f /var/lock/subsys/$prog | |
return $retval | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart|reload) | |
stop | |
start | |
;; | |
*) | |
echo "Usage: <servicename> {start|stop|reload|restart}" | |
exit 1 | |
;; | |
esac | |
exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
suggested additions for pid file: