vim autoscan.sh  #建立自动扫描脚本

#!/bin/bash PATH=/usr/bin:/bin CLAMSCANTMP=`mktemp` clamdscan --recursive --remove / > $CLAMSCANTMP [ ! -z "$(grep FOUND$ $CLAMSCANTMP)" ] && \ grep FOUND $CLAMSCANTMP | mail -s "Virus Found in `hostname`" root rm -f $CLAMSCANTMP

chmod 700 autoscan.sh  #赋予脚本可被执行的权限

crontab –e   #编辑计划任务,添加如下行

00 03 * * * /root/scan.sh   #添加这一行,让其在每天3点钟执行扫描 
05-03 23:24