Main menu:


April 2014
M T W T F S S
« Mar   Jul »
 123456
78910111213
14151617181920
21222324252627
282930  

Archives

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

[Unit]
Description=Home Directory Virus Scan

[Service]
Type=oneshot
ExecStart=/usr/bin/clamscan --log=/var/log/clamav/clamd.log --remove=yes --recursive /home/ --infected
Nice=19
IOSchedulingClass=best-effort
IOSchedulingPriority=7

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

[Unit]
Description=Home Directory Virus Scan

[Timer]
OnCalendar=weekly
AccuracySec=12h
Persistent=true

[Install]
WantedBy=multi-user.target

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 *