0

I'm trying to run a command once per day like so:

<?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">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>local.borgmatic</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/borgmatic</string>
        <string>--syslog-verbosity</string>
        <string>1</string>
    </array>
    <key>EnvironmentVariables</key>
    <dict>
        <key>HOME</key>
        <string>/Users/mike</string>
    </dict>
    <key>StartInterval</key>
    <integer>86400</integer>
</dict>
</plist>

The problem is this job never seems to run on its own. If it was just failing, I'd expect to see an error message from launchd in system.log, but I don't see anything, even after leaving my computer running for several days with hibernation disabled. The job shows up in launchctl list and runs fine when I start it manually via launchctl start. It also runs automatically when I reduce StartInterval to something smaller, like 10. Does StartInterval have some undocumented maximum?

Incidentally, this looks like the same problem reported at OS X launchd.plist.

2
  • Just wondering, where do you have this job located, what is the path of the folder that the plist is in? I'm wondering, if you change it's location, does that change things? – ErniePC12 Jan 30 at 13:20
  • @ErniePC12 I put it in ~/Library/LaunchAgents/, but I just realized something else. I don't think StartInterval works across reboots, which is a problem if you want to run something at most once per day, but you don't know what time your computer will be on. I think anacron might solve this, but it doesn't seem to be available on OSX. – Mike Conigliaro Jan 30 at 17:55
0

Can you try placing the following in your launchd file.

<key>RunAtLoad</key>
<true/>

See how that works after you start up as well.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .