Skip to content

Bash script to run ClamAV and scan your files for viruses

Notifications You must be signed in to change notification settings

DallasO/ClamAV-cron-scan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CircleCI

ClamAV-cron-scan

This is a custom script that allows a user to scan their ~/home folder using a popular AntiVirus software available for Linux - ClamAV.

View the ClamAV Github page.

ClamAV Installation

Follow the recommended installation steps for your distro on their documentation page.

For an interactive gui, also install their clamtk package.
E.g. Debian: $ sudo apt install clamav clamtk

How to use this script

Set an hourly cron

  1. Make sure this script is executable

    $ chmod u+x ClamAVCron.sh
    
  2. If you would like to invoke this script at any time from the terminal, or share with other users,
    link it in /usr/local/bin (see run-parts)

    # ln -s /path/to/ClamAVCron.sh /usr/local/bin/clamscan-cron
    
  3. Add the following line to your crontab using crontab -e:
    Replace [period] with number of days between scans. default: 7

    @hourly /usr/local/bin/clamscan-cron user [period] >/dev/null 2>&1
    

Planned features

  • Add list of directories to ignore (ie, node_modules, python_modules, .git, etc.)
  • Should use tmp file for logfile until scan complete
  • Change to sh for more portability
  • Eventually fix notifications :/
  • Command line arguments for more flexibility
  • Multiple distro support - if necessary
  • Show a progress notification? Sounds like a hack that won't be efficient. Maybe just change final notification to a summary.