#!/bin/sh # Post.Office Anti-Virus Solution - Daemon Script # Copyright by Joe Savelberg -- jmsc@euregio.net # version 0.9 -- 2004-03-15 @ 17:30 GMT # http://www.euregio.net/joe/postoffice/ # Use at own risk. Virex does delete viruses # # Install this script in your root home directory # chmod 755 to make it executable # Decide where you want to put the preference file. You can edit the preference # file while the daemon is running, e.g. if you want to change the wait period # between iterations or if you want to stop the daemon. preffile="/etc/virexdaemon.conf" # Tell the script about the name of your anti-virus script. That script # will be executed by this daemon. Make sure the path is correct. virexscript="/var/root/virexscript.sh" # If the preference file does not exist, the script will create it in the # location you specified above. Default preferences will be written to that # new preference file. if [ ! -f $preffile ] then echo "Creating preference file in $preffile" echo "######################################################## # Post.Office Anti-Virus Solution - Daemon Preferences # # Copyright 2004 by Joe Savelberg - jmsc@euregio.net # # # # run=[true|false] enables or disables the daemon # # wait=[0-9] the number of seconds to wait between # # iterations of the scanning script. It # # depends on your server speed but 5 sec # # should work quite good and 2 works as # # well on a fast server. # ######################################################## run=true wait=2 debug=false "> $preffile fi # This is the actual daemon loop which will execute your Anti-Virus # script and wait between iterations as specified by wait=[0-9] scan=`grep "run=" $preffile | grep -v "#" | cut -d "=" -f 2` debug=`grep "debug=" $preffile | grep -v "#" | cut -d "=" -f 2` if [ -z $debug ] ; then debug=false fi if [ $debug ] ; then echo "`date` [$$] Starting Virex Daemon" >> /var/log/virexdebug.log fi while $scan do scan=`grep "run=" $preffile | grep -v "#" | cut -d "=" -f 2` if [ $debug ] ; then echo "`date`" >> /var/log/virexdebug.log $virexscript >> /var/log/virexdebug.log 2>&1 else $virexscript fi mypause=`grep "wait=" $preffile | grep -v "#" | cut -d "=" -f 2` sleep $mypause done #end