Skip to navigation
Cron script to scan a linux box for viruses
17.06.21
#!/bin/bash # # clamav-cron v. 0.6 - Copyright © 2009, Stefano Stagnaro # This is Free Software released under the GNU GPL license version 3 #============================================# # User configuration section # #============================================# # Log file name and its path: CV_LOGFILE="$HOME/clamav-cron.log" # Notification e-mail sender (could be fake): CV_MAILFROM="david@ddsbkk.com" # Notification e-mail recipient: CV_MAILTO_CC="veto@myridia.com" # Notification e-mail secondary recipients: CV_MAILTO="david@ddsbkk.com" # Notification e-mail subject: CV_SUBJECT="ClamAV scan completed ddit-server.com" #============================================# CV_TARGET="$1" CV_VERSION="0.6" if [ -e $CV_LOGFILE ] then /bin/rm $CV_LOGFILE fi if [ -z "$1" ] then CV_TARGET="/var/customers" fi #To be read on stdout (and root mail): echo -e `basename $0` v. $CV_VERSION - Copyright 2009, Stefano Stagnaro '\n' #To be read on logfile (sent via sendmail): echo -e $CV_SUBJECT - $(date) '\n' >> $CV_LOGFILE echo -e Script: `basename $0` v. $CV_VERSION - Copyright 2009, Stefano Stagnaro >> $CV_LOGFILE echo -e Scanned: $CV_TARGET on $HOSTNAME'\n' >> $CV_LOGFILE #/usr/bin/freshclam --log=$CV_LOGFILE --user $USER --verbose #To be read on stdout (and root mail): echo -e '------------------------------------\n' /usr/bin/clamscan --verbose --infected --remove --log=$CV_LOGFILE --recursive $CV_TARGET CLAMSCAN=$? if [ "$CLAMSCAN" -eq "1" ] then CV_SUBJECT="[VIRUS!] "$CV_SUBJECT elif [ "$CLAMSCAN" -gt "1" ] then CV_SUBJECT="[ERR] "$CV_SUBJECT fi /usr/bin/mail -s "$CV_SUBJECT" $CV_MAILTO < $CV_LOGFILE
https://github.com/yangwithinyin/clamav-cron/blob/master/clamav-cron.sh
Reply
Anonymous
Information Epoch 1732546897
Think parallel.
Home
Notebook
Contact us