Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # Copyright (C) 2005-2011 by Jordi Sanfeliu <[email protected]>
- #
- # monitorix Starts/Stop the Monitorix daemon
- #
- # chkconfig: 2345 99 10
- # description: lightweight system monitoring tool
- # processname: monitorix
- # pidfile: /var/run/monitorix.pid
- # Source function library.
- . /etc/init.d/functions
- RETVAL=0
- LOCK="/var/lock/subsys/monitorix"
- PROG="monitorix"
- CONF="/etc/monitorix.conf"
- start() {
- if [ ! -f $LOCK ] ; then
- echo -n $"Starting $PROG: "
- daemon /usr/bin/$PROG -c $CONF && success || failure
- RETVAL=$?
- if [ $RETVAL -eq 0 ] ; then
- pid=`pidof -o %PPID $PROG`
- touch /var/lock/subsys/$PROG
- echo $pid > /var/run/$PROG.pid
- echo
- fi
- fi
- }
- stop() {
- echo -n $"Stopping $PROG: "
- killproc $PROG
- RETVAL=$?
- rm -f /var/lock/subsys/$PROG
- rm -f /var/run/$PROG
- echo
- }
- restart() {
- stop
- start
- }
- case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- restart)
- restart
- ;;
- status)
- status $PROG
- ;;
- *)
- echo $"Usage: $0 {start|stop|restart|status}"
- exit 1
- esac
- exit $RETVAL
Advertisement
Add Comment
Please, Sign In to add comment