Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #!/bin/bash
  2. #===================================================================================
  3. #
  4. #         FILE: clamdctl
  5. #
  6. #        USAGE: clamdctl [start|stop|restart|help] [-h|--help]
  7. #
  8. #  DESCRIPTION: Startup script for clamd daemon
  9. #               ClamAV is an open source (GPL) antivirus engine designed for
  10. #               detecting Trojans, viruses, malware and other malicious threats.
  11. #
  12. #  _____  _              _         _____  _                     _____     _____
  13. # |   __||_| _____  ___ | | ___   |  _  || | ___  ___    ___   |   __|   |  _  |
  14. # |__   || ||     || . || || -_|  |   __|| || .'||   |  |___|  |__   | _ |   __|_
  15. # |_____||_||_|_|_||  _||_||___|  |__|   |_||__,||_|_|         |_____||_||__|  |_|
  16. #                  |_|
  17. #
  18. #===================================================================================
  19. #
  20. PATH=/usr/local/clamav/sbin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
  21. export PATH
  22. RETVAL=0
  23. PROG=clamd
  24. DAEMON=/usr/local/sbin/clamd
  25. #
  26. function start()
  27. {
  28.     echo -n $"Starting $PROG daemon ... "
  29.     $DAEMON
  30.     echo "done."
  31. }
  32. #
  33. function stop()
  34. {
  35.     echo -n $"Stopping $PROG daemon ... "
  36.     killall -TERM $PROG
  37.     echo "done."
  38. }
  39. #
  40. # See how we were called.
  41. case "$1" in
  42.     start)
  43.         start
  44.         ;;
  45.     stop)
  46.         stop
  47.         ;;
  48.     restart)
  49.         stop
  50.         start
  51.         ;;
  52.     help|-h|--help)
  53.         $DAEMON --help
  54.         ;;
  55.     *)
  56.         echo "Usage: $PROG start|stop|restart|help"
  57.         RETVAL=2
  58.         ;;
  59. esac
  60. #
  61. exit $RETVAL