Scheduling virus scans on Arch Linux

Virus threats under Linux are mostly negligible. But I might still want to keep my system free from virus infected downloads and such. There is no need for on-access scanning and a weekly disk scan should do.
Under Arch Linux, I have clamav installed with freshclam service enabled so it auto updates the virus signatures.
Let us say I want to scan my /home partition once a week.

I will create a unit file /etc/systemd/system/clamscan.service

Description=Home Directory Virus Scan

ExecStart=/usr/bin/clamscan --log=/var/log/clamav/clamd.log --remove=yes --recursive /home/ --infected

and a timer file /etc/systemd/system/clamscan.timer

Description=Home Directory Virus Scan



Finally I can type:

systemctl enable clamscan.timer
systemctl start clamscan.timer

Running systemctl list-timers shows the active systemd timers.
And that’s it. Now clamav will scan the /home partition once a week, delete infected files and log its activity to clamd.log 🙂 .

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.