home *** CD-ROM | disk | FTP | other *** search
/ Chip 2006 June (Extra) / CHIP 2006-06.3.iso / program / opensource / clamav-devel.exe / contrib / init / RedHat / clamd < prev   
Encoding:
Text File  |  2006-05-16  |  1.3 KB  |  87 lines

  1. #! /bin/bash
  2. #
  3. # crond   Start/Stop the clam antivirus daemon.
  4. #
  5. # chkconfig: 2345 70 41
  6. # description: clamd is a standard Linux/UNIX program that scans for Viruses.
  7. # processname: clamd
  8. # config: /usr/local/etc/clamd.conf
  9. # pidfile: /var/lock/subsys/clamd
  10.  
  11. # Source function library.
  12. . /etc/init.d/functions
  13.  
  14. RETVAL=0
  15.  
  16. # See how we were called.
  17.  
  18. prog="clamd"
  19. progdir="/usr/local/sbin"
  20.  
  21. # Source configuration
  22. if [ -f /etc/sysconfig/$prog ] ; then
  23.     . /etc/sysconfig/$prog
  24. fi
  25.  
  26. start() {
  27.     echo -n $"Starting $prog: "
  28.         LANG= daemon $progdir/$prog
  29.     RETVAL=$?
  30.     echo
  31.     [ $RETVAL -eq 0 ] && touch /var/lock/subsys/clamd
  32.     return $RETVAL
  33. }
  34.  
  35. stop() {
  36.     echo -n $"Stopping $prog: "
  37.     # Would be better to send QUIT first, then killproc if that fails
  38.     killproc $prog
  39.     RETVAL=$?
  40.     echo
  41.     [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/clamd
  42.     return $RETVAL
  43. }
  44.  
  45. rhstatus() {
  46.     status clamd
  47. }
  48.  
  49. restart() {
  50.     stop
  51.     start
  52. }
  53.  
  54. reload() {
  55.     echo -n $"Reloading clam daemon configuration: "
  56.     killproc clamd -HUP
  57.     retval=$?
  58.     echo
  59.     return $RETVAL
  60. }
  61.  
  62. case "$1" in
  63.   start)
  64.     start
  65.     ;;
  66.   stop)
  67.     stop
  68.     ;;
  69.   restart)
  70.     restart
  71.     ;;
  72.   reload)
  73.     reload
  74.     ;;
  75.   status)
  76.     rhstatus
  77.     ;;
  78.   condrestart)
  79.     [ -f /var/lock/subsys/clamd ] && restart || :
  80.     ;;
  81.   *)
  82.     echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}"
  83.     exit 1
  84. esac
  85.  
  86. exit $?
  87.