A launchd plist for freshclam

by Adrian 5th Jun, 2005 @ 21:24

UPDATE: This will not work well under OS X 10.2.4, Launchd doesn't like the fact that freshclam runs in less than sixty seconds and will eventually stop running freshclam. I reverted to using a cron job instead of this plist.

I use ClamAV to scan all my incoming e-mail for Virus (and these days it also catches a good many phishing scam e-mails too), installed with Fink. I couldn't find a plist to have launchd run it so I've written my own, and am sharing it with the world:

sudo nano /Library/LaunchDaemons/org.fink.freshclam.plist

And paste this in (remove the / from the Doctype line and make sure the whole Doctype is on one line before you use it), or download the attached version at the end of the post:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>Freshclam</string>
  <key>Disabled</key>
  <false/>
  <key>GroupName</key>
  <string>admin</string>
  <key>UserName</key>
  <string>root</string>
  <key>RunAtLoad</key>
  <true/>
  <key>StartInterval</key>
  <integer>7200</integer>
  <key>Program</key>
  <string>/sw/bin/freshclam</string>
  <key>ProgramArguments</key>
  <array>
    <string>--quiet</string>
    <string>-l</string>
    <string>/var/log/clam-update.log</string>
  </array>
</dict>
</plist>

And start it running with:

sudo launchctl load /Library/LaunchDaemons/org.fink.freshclam.plist

Thus far only the first run has worked, I'll know in a couple of hours if it's working properly and checking approximately every two hours ;)

UPDATE: It's working fine. Roughly every two hours.

AttachmentSize
org.fink.freshclam.plist643 bytes