Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I run an antivirus s/w as a cron job to check for virus on a particular set of folders on my server(Apache, Drupal) where I store the files retrieved from users?

Any ideas?

share|improve this question
What antivirus software? – voretaq7 Oct 7 '11 at 19:51
Sorry.. I have not decided on it yet.. I am open to suggestions even in this case.. – Bharath ABK Oct 7 '11 at 19:58
What operating system? – John Gardeniers Oct 7 '11 at 21:08
up vote 3 down vote accepted

Install ClamAV and set the cron job to run clamscan /path/to/folder

share|improve this answer
That would be my suggestion if you're on a *nix box. I'd go one step more though and say move the files to a "clean" folder after they're scanned so you're not always re-scanning the same files. – voretaq7 Oct 7 '11 at 20:09
Note that there may be some value to periodic rescanning of "clean" files: over time, zero-day threats become known threats. – Skyhawk Oct 7 '11 at 20:39

You'll need to install an AV client which supports command line arguments and some form of script-able definition and executable update.

AVG and Clam can do this - you need to decide which is more suitable for you.

You may want to reconsider using CRON to launch a virus scan, and instead use a directory change trigger, which launches the scan as the new file is created. A perl module is available as an example.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.