Eu tropecei nesta página, quando eu estava procurando por um script clamscan. Eu segui o conselho acima e consegui trabalhar com ele:
#!/usr/bin/bash
# Create Hourly Cron Job With Clamscan
# Directories to scan
scan_dir="/home"
# Temporary file
list_file=$(mktemp -t clamscan.XXXXXX) || exit 1
# Location of log file
log_file="/var/log/clamav/hourly_clamscan.log"
# Make list of new files
if [ -f "$log_file" ]
then
# use newer files then logfile
find "$scan_dir" -type f -cnewer "$log_file" -fprint "$list_file"
else
# scan last 60 minutes
find "$scan_dir" -type f -cmin -60 -fprint "$list_file"
fi
if [ -s "$list_file" ]
then
# Scan files and remove (--remove) infected
clamscan -i -f "$list_file" --remove=yes > "$log_file"
# If there were infected files detected, send email alert
if [ 'cat $log_file | grep Infected | grep -v 0 | wc -l' != 0 ]
then
HOSTNAME='hostname'
echo "$(egrep "FOUND" $log_file)" | mail -s "VIRUS PROBLEM on $HOSTNAME" -r [email protected] [email protected]
fi
else
# remove the empty file, contains no info
rm -f "$list_file"
fi
exit
Era um script de hora em hora no meu caso, mas deveria funcionar diariamente (modificar a segunda descoberta).