2015-10-16

[SOLVED]ClamAV & AVG for Ubuntu Server-script

#13:41 23/09/2015
root@srv142 /opt/script# crontab -l
#Sync Time Server, daily, at 0h01:
01 0 * * * /opt/script/time-force-update
#
#Starting update ClamAV daily, at 01h05:
05 1 * * * freshclam
#
#Starting scan emailserver daily, at 01h30:
30 1 * * * /opt/script/scan-email-virus-daily-clamav
#
#Starting update AVG daily, at 4h05:
05 4 * * * avgupdate
#
#Starting scan emailserver daily, at 4h30:
30 4 * * * /opt/script/scan-email-virus-daily-avg
#
#Delete old file, 2 day in the past at 6h05:
05 6 * * * /opt/script/delete-old-files

#Every 5 mins FW RESTORE:
#*/5 * * * * /opt/script/fwrestore

#Stop OpenVPN Server at 31/08/2015 21h00:
#0 21 31 8 2015 kill 29583
root@srv142 /opt/script# cat /opt/script/scan-email-virus-daily-clamav
#----------------------------------------------------#
# Version 01| LastUpdated: 9:04 15/01/2015
# Copyright 2014 (C)QWERTY: tinhcx@gmail.com
#----------------------------------------------------
now="$(date +'%Y.%m.%d-%H.%M.%S')"
CURRENT_TIME=$now
cd /opt/
FILE_SOURCE=kerio
FULL_PATH=$(pwd)/$FILE_SOURCE
echo "------------------------------------------------------------------[SCAN: $FULL_PATH]"
echo "#Scan at [$CURRENT_TIME] | Starting...."
clamscan -r --copy=/opt/temp/ $FILE_SOURCE  > /opt/bk-data/clamscan-$CURRENT_TIME.log 2>&1
now1="$(date +'%Y.%m.%d-%H.%M.%S')"
mv /opt/bk-data/clamscan-$CURRENT_TIME.log /opt/bk-data/clamscan-$CURRENT_TIME--$now1.log
echo "#Scan at [$now1] | Done"
echo "------------------------------------------------------------------"

#clamscan -ir /opt/kerio -l cscanreport




root@srv142 /opt/script# cat /opt/script/scan-email-virus-daily-avg
#avgscan /opt/kerio/ -l -t -u -U
#----------------------------------------------------#
# Version 01| LastUpdated: 9:04 15/01/2015
# Copyright 2014 (C)QWERTY: tinhcx@gmail.com
#----------------------------------------------------
now="$(date +'%Y.%m.%d-%H.%M.%S')"
CURRENT_TIME=$now
cd /opt/
FILE_SOURCE=kerio
FULL_PATH=$(pwd)/$FILE_SOURCE
echo "------------------------------------------------------------------[SCAN: $FULL_PATH]"
echo "#Scan at [$CURRENT_TIME] | Starting...."
avgscan $FILE_SOURCE -l -t -u -U > /opt/bk-data/avgscan-$CURRENT_TIME.log 2>&1
now1="$(date +'%Y.%m.%d-%H.%M.%S')"
mv /opt/bk-data/avgscan-$CURRENT_TIME.log /opt/bk-data/avgscan-$CURRENT_TIME--$now1.log
echo "#Scan at [$now1] | Done"
echo "------------------------------------------------------------------"
root@srv142 /opt/script#

No comments:

Post a Comment