Setting up ClamAV cron is an easy task, and a developer called “Stefano Stagnaro” uploaded a great cron script called “clamav-cron” in Google codes that will update ClamAV scan the system and will send a brief report via email. Please follow the below steps to set this.
Go to “/opt” ,download the “clamav-cron” and give execute permission.
cd /opt wget http://clamav-cron.googlecode.com/files/clamav-cron-0.6 -O /usr/local/bin/clamav-cronchmod 755 /usr/local/bin/clamav-cron
Open the “/usr/local/bin/clamav-cron” and edit user information.
vim /usr/local/bin/clamav-cron --- # Notification email recipient: CV_MAILTO="your email ID here" # Notification email secondary recipients: CV_MAILTO_CC="cc mails here" # Notification email subject: CV_SUBJECT="Desired Subject line here" ---
As you can see, there are several customization options available. You can also add your codes and scan options if required. If you want an email alert each time a scan is complete, make sure you edit and add correct details in the above section. If you don’t want an email alert, make sure you comment “CV_MAILTO, CVMAILTO_CC and “CV_SUBJECT”. This will be using the default system mail function, so this will work without any further modification.
Set a cron job. I’m going to set a cron job to run this task every Saturday at 11.45 PM.
crontab -e
Add the lines at the end.
45 23 * * 6 /usr/local/bin/clamav-cron /
Restart cron service.
/etc/init.d/crond restart
That’s it!! You have set up the ClamAV cron script. This will automate the Clamscan process.