wok annotate clamav/stuff/daemon-clamd @ rev 19247
pciids, usbids: recompress with advdef
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Jun 29 10:29:16 2016 +0200 (2016-06-29) |
parents | e43926392669 |
children | f9740579460f |
rev | line source |
---|---|
paul@1104 | 1 #!/bin/sh |
al@19159 | 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 |
al@19159 | 12 DESC="$(_ '%s daemon' clamav)" |
paul@1104 | 13 DAEMON=/usr/sbin/clamd |
paul@1104 | 14 OPTIONS=$CLAMD_OPTIONS |
paul@16157 | 15 PIDFILE=/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 |
al@19159 | 20 _ '%s is already running.' $NAME |
paul@1104 | 21 exit 1 |
paul@1104 | 22 fi |
al@19159 | 23 action 'Starting %s: %s...' "$DESC" $NAME |
al@19159 | 24 $DAEMON $OPTIONS |
paul@1104 | 25 status |
paul@1104 | 26 ;; |
paul@1104 | 27 stop) |
pascal@11688 | 28 if ! active_pidfile $PIDFILE clamd ; then |
al@19159 | 29 _ '%s is not running.' $NAME |
paul@1104 | 30 exit 1 |
paul@1104 | 31 fi |
al@19159 | 32 action 'Stopping %s: %s...' "$DESC" $NAME |
al@19159 | 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 |
al@19159 | 39 _ '%s is not running.' $NAME |
paul@1104 | 40 exit 1 |
paul@1104 | 41 fi |
al@19159 | 42 action 'Restarting %s: %s...' "$DESC" $NAME |
al@19159 | 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 *) |
al@19159 | 50 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]" |
al@19159 | 51 newline |
paul@1104 | 52 exit 1 |
paul@1104 | 53 ;; |
paul@1104 | 54 esac |
paul@1104 | 55 |
paul@1104 | 56 exit 0 |