daily pastebin goal
73%
SHARE
TWEET

Untitled

a guest Jul 16th, 2012 30 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          mrtg
  4. # Required-Start:
  5. # Required-Stop:
  6. # Default-Start:     2 3 4 5
  7. # Default-Stop:      0 1 6
  8. # Short-Description: mrtg init script
  9. # Description:       This file is used to start, stop, restart,
  10. #                                        and determined status of the mrtg daemon.
  11. # Author:                        iceflatline <iceflatline@gmail.com>
  12. ### END INIT INFO
  13.  
  14. ### START OF SCRIPT
  15. set -e
  16. # PATH should only include /usr/* if it runs after the mountnfs.sh script
  17. PATH=/sbin:/usr/sbin:/bin:/usr/bin
  18. DESC="mrtg"
  19. NAME=mrtg
  20. DAEMON=/usr/bin/$NAME
  21. DAEMON_ARGS="/etc/mrtg/mrtg.cfg"
  22. PIDFILE=/etc/mrtg/$NAME.pid
  23. SCRIPTNAME=/etc/init.d/$NAME
  24.  
  25. # Exit if the mrtg package is not installed
  26. [ -x "$DAEMON" ] || exit 0
  27.  
  28. # Load the VERBOSE setting and other rcS variables
  29. . /lib/init/vars.sh
  30.  
  31. # Define LSB log_* functions.
  32. # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
  33. . /lib/lsb/init-functions
  34.  
  35. # Function that starts the mrtg daemon
  36. start()
  37. {
  38.         env LANG=C start-stop-daemon --start --quiet \
  39.         --exec $DAEMON -- $DAEMON_ARGS
  40. }
  41.  
  42. # Function that stops the mrtg daemon
  43. stop()
  44. {
  45.         start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
  46.         --pidfile $PIDFILE
  47. }
  48.  
  49. case "$1" in
  50.   start)
  51.         echo "Starting $DESC"
  52.         log_daemon_msg "Starting $DESC"
  53.         start
  54.         case "$?" in
  55.                 0) log_end_msg 0 ;;
  56.                 1) log_end_msg 1 ;;
  57.         esac
  58.         ;;
  59.   stop)
  60.         log_daemon_msg "Stopping $DESC"
  61.         stop
  62.         case "$?" in
  63.                 0) log_end_msg 0 ;;
  64.                 1) log_end_msg 1 ;;
  65.         esac
  66.         ;;
  67.   restart|force-reload)
  68.         log_daemon_msg "Restarting $DESC"
  69.         stop
  70.         case "$?" in
  71.           0|1)
  72.                 start
  73.                 case "$?" in
  74.                         0) log_end_msg 0 ;;
  75.                         1) log_end_msg 1 ;;
  76.                 esac
  77.                 ;;
  78.         esac
  79.         ;;
  80.         status)
  81.     status_of_proc "$DAEMON" "$NAME"
  82.     ;;
  83.   *)
  84.         echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}"
  85.         ;;
  86. esac
  87. exit 0
  88. ### END OF SCRIPT
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top