wok-6.x annotate clamav/stuff/daemon-clamd @ rev 10151
Up: perl-datetime to 0.69.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Fri May 20 19:27:46 2011 +0000 (2011-05-20) |
parents | |
children | fcb3e7fb7bfa |
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 |
paul@1104 | 15 PIDFILE=/var/run/clamd.pid |
paul@1104 | 16 |
paul@1104 | 17 case "$1" in |
paul@1104 | 18 start) |
paul@1104 | 19 if [ -f $PIDFILE ] ; 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) |
paul@1104 | 28 if [ ! -f $PIDFILE ] ; 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) |
paul@1104 | 38 if [ ! -f $PIDFILE ] ; 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 |