Advertisement
class101

Monit 5.6 init script

Jan 22nd, 2014
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.37 KB | None | 0 0
  1. #! /bin/sh
  2. #
  3. # monit         Monitor Unix systems
  4. #
  5. # Author:   Clinton Work,   <work@scripty.com>
  6. #
  7. # chkconfig:    2345 98 02
  8. # description:  Monit is a utility for managing and monitoring processes,
  9. #               files, directories and filesystems on a Unix system.
  10. # processname:  monit
  11. # pidfile:      /var/run/monit.pid
  12. # config:       /etc/monit.conf
  13. CONF=/etc/monit.conf
  14. MONIT=/tools/monit-5.6/bin/monit
  15.  
  16. # Source function library.
  17. . /etc/rc.d/init.d/functions
  18.  
  19. # Source networking configuration.
  20. . /etc/sysconfig/network
  21.  
  22.  
  23. # Source monit configuration.
  24. if [ -f /etc/sysconfig/monit ] ; then
  25.         . /etc/sysconfig/monit
  26. fi
  27.  
  28. [ -f $MONIT ] || exit 0
  29.  
  30. RETVAL=0
  31.  
  32. # See how we were called.
  33. case "$1" in
  34.   start)
  35.         echo -n "Starting monit: "
  36.         daemon $NICELEVEL $MONIT -c $CONF
  37.         RETVAL=$?
  38.         echo
  39.         [ $RETVAL = 0 ] && touch /var/lock/subsys/monit
  40.         ;;
  41.   stop)
  42.         echo -n "Stopping monit: "
  43.         killproc monit
  44.         RETVAL=$?
  45.         echo
  46.         [ $RETVAL = 0 ] && rm -f /var/lock/subsys/monit
  47.         ;;
  48.   restart)
  49.     $0 stop
  50.     $0 start
  51.     RETVAL=$?
  52.     ;;
  53.   condrestart)
  54.        [ -e /var/lock/subsys/monit ] && $0 restart
  55.        ;;
  56.   status)
  57.         status monit
  58.     RETVAL=$?
  59.     ;;
  60.   *)
  61.     echo "Usage: $0 {start|stop|restart|condrestart|status}"
  62.     exit 1
  63. esac
  64.  
  65. exit $RETVAL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement