tags:

views:

5

answers:

0

On an OS X 10.6 system I am trying to use StartCalendarInterval in launchd to replicate a cron job that runs on the 5 minute marks of the hour. (It is important in my application to start when requested and not merely start again five minutes after the previous invocation.) I find that the actual start time of the job varies considerably and can take up to four minutes past the requested time to start. On the other hand cron will start the job within a few seconds of the requested time.

In googling I have been unable to find a solution though there are reports of this issue dating to 10.4. Has anyone found the proper magic to get the precision out of launchd that exists with cron?

The beginning of the plist I use is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>[snip]</string>
    <key>ProgramArguments</key>
    <array>
        <string>[snip]</string>
    </array>
    <key>LowPriorityIO</key>
    <true/>
    <key>Nice</key>
    <integer>1</integer>
    <key>KeepAlive</key>
    <false/>
    <key>StartCalendarInterval</key>
    <array>
        <dict>
            <key>Weekday</key>
            <integer>1</integer>
            <key>Hour</key>
            <integer>6</integer>
            <key>Minute</key>
            <integer>5</integer>
        </dict>
        <dict>
            <key>Weekday</key>
            <integer>1</integer>
            <key>Hour</key>
            <integer>6</integer>
            <key>Minute</key>
            <integer>10</integer>
        </dict>

Thank you in advance for any help.