Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/sh
- ### BEGIN INIT INFO
- # Provides: mrtg
- # Required-Start:
- # Required-Stop:
- # Default-Start: 2 3 4 5
- # Default-Stop: 0 1 6
- # Short-Description: mrtg init script
- # Description: This file is used to start, stop, restart,
- # and determined status of the mrtg daemon.
- # Author: iceflatline <iceflatline@gmail.com>
- ### END INIT INFO
- ### START OF SCRIPT
- set -e
- # PATH should only include /usr/* if it runs after the mountnfs.sh script
- PATH=/sbin:/usr/sbin:/bin:/usr/bin
- DESC="mrtg"
- NAME=mrtg
- DAEMON=/usr/bin/$NAME
- DAEMON_ARGS="/etc/mrtg/mrtg.cfg"
- PIDFILE=/etc/mrtg/$NAME.pid
- SCRIPTNAME=/etc/init.d/$NAME
- # Exit if the mrtg package is not installed
- [ -x "$DAEMON" ] || exit 0
- # Load the VERBOSE setting and other rcS variables
- . /lib/init/vars.sh
- # Define LSB log_* functions.
- # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
- . /lib/lsb/init-functions
- # Function that starts the mrtg daemon
- start()
- {
- env LANG=C start-stop-daemon --start --quiet \
- --exec $DAEMON -- $DAEMON_ARGS
- }
- # Function that stops the mrtg daemon
- stop()
- {
- start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
- --pidfile $PIDFILE
- }
- case "$1" in
- start)
- echo "Starting $DESC"
- log_daemon_msg "Starting $DESC"
- start
- case "$?" in
- 0) log_end_msg 0 ;;
- 1) log_end_msg 1 ;;
- esac
- ;;
- stop)
- log_daemon_msg "Stopping $DESC"
- stop
- case "$?" in
- 0) log_end_msg 0 ;;
- 1) log_end_msg 1 ;;
- esac
- ;;
- restart|force-reload)
- log_daemon_msg "Restarting $DESC"
- stop
- case "$?" in
- 0|1)
- start
- case "$?" in
- 0) log_end_msg 0 ;;
- 1) log_end_msg 1 ;;
- esac
- ;;
- esac
- ;;
- status)
- status_of_proc "$DAEMON" "$NAME"
- ;;
- *)
- echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}"
- ;;
- esac
- exit 0
- ### END OF SCRIPT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement