mrtg/mrtg-initscript

48 lines
890 B
Bash

#!/bin/bash
#
# chkconfig: 2345 65 15
# description: Multi Router Traffic Grapher
# processname: mrtg
# Copyright (c) 2003-2006 by Silvan Calarco <silvan.calarco@qilinux.it>
# Copyright (c) 2004-2006 by Davide Madrisan <davide.madrisan@qilinux.it>
# source function library
. /etc/rc.d/init.d/functions
RETVAL=0
case "$1" in
start)
echo -n "Starting mrtg daemon: "
loadproc env LANG=C mrtg --daemon /etc/mrtg/mrtg.cfg \
--logging /var/log/mrtg.log > /dev/null
evaluate_retval
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/mrtg
echo
;;
stop)
echo -n "Shutting down mrtg daemon: "
killproc mrtg
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/mrtg
;;
restart|reload)
$0 stop
$0 start
RETVAL=$?
;;
status)
status mrtg
RETVAL=$?
;;
*)
gprintf "Usage: mrtg {start|stop|status|restart|reload}\n"
exit 1
esac
exit $RETVAL