April 05, 2016

Cronnix, crontab & clamscan

Now that you have that clamscan installed, you should create a scheduled scan of your machine. You can do this by adding a crontab job. Crontab is a way to schedule programs to run on various times. Another chrotab job could be a backup, but that's for a different post.

Cronnix, is a GUI for cron, you can install and use this on OSX using ports. IT makes the interface to cron easier to understand for users that don't like to read man pages. If you're ok with man stick to man cron and man cron.

sudo port install cronnix

Select the Cronnix app, and click it.

Next, select new.
Then insert the command you'd like to run: /opt/local/bin/clamscan -r -i -o.  Select simple and select the timing for your cron job.
Press save, and your crontab job should be stored. To verify the schedule you can open a terminal and run:
crontab -l
0    20    *    *    7    /opt/local/bin/clamscan -r -i -o

The above displays the contents of your crontab file. The short version is that every entry in this file divided by a tab character can be read as this: min | hour | day | month | weekday | user | command.

So, the above crontab entry translates to: every sunday @ 20:00 run clamscan. You can get at thorough explanation of cron here. The crontab file is located in /usr/lib/cron/tabs. You can only see the file and contents as super user.

To get a freshclam file you can either create a freshclam entry in crontab or run freshclam as a deamon using:

sudo freshclam -d -c 2 &

The above command executes freshclam as a deamon and checks for a new file twice a day. See man freshclam for detatil.

No comments: