>From: Dennis Peterson [mailto:denni...@inetnw.com]
>
>Such scripts are rather easily constructed using a basic template:
>
>----------------
>#!/bin/sh
># set environment variables
># example:
>
>LD_LIBRARY_PATH="/somewhere/over/the/rainbow:/usr/lib"
>ClamdOptions="--this --that --whatever"
>
># To encourage anal behavior
>unalias start
>unalias stop
>unalias restart
>
>start()
>{
>       # do stuff to start the product
>       /usr/sbin/clamd $ClamdOptions && \
>       echo "clamd startup attempted"
>}
>
>stop()
>{
>       # do stuff to stop the product
>       /usr/bin/pkill -x -u clamav clamd &&\
>       echo "clamd shutdown attempted"
>}
>
>case "$1" in
>start)
>       start
>       ;;
>stop)
>       stop
>       ;;
>restart)
>       # don't restart it if we don't kill it successfully
>       stop && start
>       ;;
>*)
>       echo "Usage: blah [start|stop|restart]
>       ;;
>       exit
>esac
>
>exit
>---------------
>
>Additional lines of code can be added to verify the star or stop actually
>happened but generally the above is often enough.
>
>dp

These days (at least in the Fedora/RedHat/CentOS world) the template init 
script should also contain a "condrestart" option, which checks whether the 
process is supposed to be running (usually by checking something like 
/var/run/clamav/clamd.pid), and runs stop/start if so.


Moray.
"To err is human.  To purr, feline"


_______________________________________________
Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net
http://www.clamav.net/support/ml

Reply via email to