Wednesday, August 24, 2005

cron jobs with launchd


In this post, I described ClamXav and how it will install a cron job to scan files as well as updating the virus definitions.  In Mac OS X 10.4, Apple has created launchd to replace crond, init, and xinitd.  So I wanted to replace with the cron jobs with Launch Actions.


Here are the plist files that I have created to replace the cron jobs.  I created these plist files with Launchd Editor, I wasn't able to get the scripts to work when I created them with Property List Editor


<?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>GroupName</key>
<string>clamav</string>
<key>Label</key>
<string>com.pwestbro.clamXavUpdate</string>
<key>LowPriorityIO</key>
<true/>
<key>Nice</key>
<integer>1</integer>
<key>Program</key>
<string>/usr/local/clamXav/bin/freshclam</string>
<key>ProgramArguments</key>
<array>
<string>--quiet</string>
<string>--log="/usr/local/clamXav/share/clamav/freshclam.log"</string>
</array>
<key>ServiceDescription</key>
<string>ClamXav Update run</string>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>11</integer>
<key>Minute</key>
<integer>30</integer>
</dict>
<key>UserName</key>
<string>clamav</string>
</dict>
</plist>


<?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>com.pwestbro.clamXav</string>
<key>LowPriorityIO</key>
<true/>
<key>Nice</key>
<integer>1</integer>
<key>Program</key>
<string>/usr/local/clamXav/bin/clamscan</string>
<key>ProgramArguments</key>
<array>
<string>-r</string>
<string>--log="/Users/pwestbro/Library/Logs/clamXav-scan.log"</string>
<string>--exclude=sit$</string>
<string>--exclude=sitx$</string>
<string>--exclude=dmg$</string>
<string>/Users/pwestbro/Documents</string>
</array>
<key>ServiceDescription</key>
<string>ClamXav scan run</string>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>12</integer>
<key>Minute</key>
<integer>15</integer>
</dict>
</dict>
</plist>

[via TUAW]


Technorati Tags: , ,

No comments:

Post a Comment

Unlocking Seamless Integration: Navigating Unexpected Hubitat Device Queries and VLAN Challenges for a Smoother Home Automation Experience

During my network debugging efforts , I came across an intriguing observation related to the two Hubitat devices on our network. The logs b...