wok-next annotate clamav/stuff/daemon-clamd @ rev 12586
json-glib: update bdeps
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Apr 28 21:40:19 2012 +0200 (2012-04-28) |
parents | fcb3e7fb7bfa |
children | e43926392669 |
rev | line source |
---|---|
paul@1104 | 1 #!/bin/sh |
paul@1104 | 2 # /etc/init.d/daemon-name: Start, stop and restart daemon |
paul@1104 | 3 # on SliTaz, at boot time or with the command line. |
paul@1104 | 4 # |
paul@1104 | 5 # To start daemon at boot time, just put the right name in the $RUN_DAEMONS |
paul@1104 | 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf. |
paul@1104 | 7 # |
paul@1104 | 8 . /etc/init.d/rc.functions |
paul@1104 | 9 . /etc/daemons.conf |
paul@1104 | 10 |
paul@1104 | 11 NAME=Clamd |
paul@1104 | 12 DESC="clamav daemon" |
paul@1104 | 13 DAEMON=/usr/sbin/clamd |
paul@1104 | 14 OPTIONS=$CLAMD_OPTIONS |
erjo@11931 | 15 PIDFILE=/var/run/clamav/clamd.pid |
paul@1104 | 16 |
paul@1104 | 17 case "$1" in |
paul@1104 | 18 start) |
pascal@11688 | 19 if active_pidfile $PIDFILE clamd ; then |
paul@1104 | 20 echo "$NAME already running." |
paul@1104 | 21 exit 1 |
paul@1104 | 22 fi |
paul@1104 | 23 echo -n "Starting $DESC: $NAME... " |
paul@1104 | 24 $DAEMON $OPTIONS |
paul@1104 | 25 status |
paul@1104 | 26 ;; |
paul@1104 | 27 stop) |
pascal@11688 | 28 if ! active_pidfile $PIDFILE clamd ; then |
paul@1104 | 29 echo "$NAME is not running." |
paul@1104 | 30 exit 1 |
paul@1104 | 31 fi |
paul@1104 | 32 echo -n "Stopping $DESC: $NAME... " |
paul@1104 | 33 kill `cat $PIDFILE` |
paul@1104 | 34 rm $PIDFILE |
paul@1104 | 35 status |
paul@1104 | 36 ;; |
paul@1104 | 37 restart) |
pascal@11688 | 38 if ! active_pidfile $PIDFILE clamd ; then |
paul@1104 | 39 echo "$NAME is not running." |
paul@1104 | 40 exit 1 |
paul@1104 | 41 fi |
paul@1104 | 42 echo -n "Restarting $DESC: $NAME... " |
paul@1104 | 43 kill `cat $PIDFILE` |
paul@1104 | 44 rm $PIDFILE |
paul@1104 | 45 sleep 2 |
paul@1104 | 46 $DAEMON $OPTIONS |
paul@1104 | 47 status |
paul@1104 | 48 ;; |
paul@1104 | 49 *) |
paul@1104 | 50 echo "" |
paul@1104 | 51 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" |
paul@1104 | 52 echo "" |
paul@1104 | 53 exit 1 |
paul@1104 | 54 ;; |
paul@1104 | 55 esac |
paul@1104 | 56 |
paul@1104 | 57 exit 0 |