0

I'm trying to setup a backup of my databases on my new mac. I've got the script created and as far as creating the launchd plist file. However, the task seems to run over and over, instead of once a day. I set the StartInterval to 86400, but the StartInterval doesn't seem to have any affect.

What can I do to make it run once per day, and not serially?

plist file:

<?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>com.dave.mysqlbackup</string>

        <key>ProgramArguments</key>
        <array>
                <string>/Users/dave/Sites/mysqldump/mysqldump.sh</string>
        </array>

        <key>OnDemand</key>
        <false/>

        <key>StartInterval</key>
        <integer>86400</integer>
</dict>
</plist>

Thanks!

davethegr8
  • 101
  • 3

1 Answers1

1

Reading through the launchd.plist man page, it also looks as if replacing:

    <key>OnDemand</key>
    <false/>

With:

    <key>KeepAlive</key>
    <false/>

May fix your existing plist. And in fact, in my testing this corrected the problem. Using a StartInterval of 60 seconds, my program ran roughly every 10 seconds until I replaced OnDemand with KeepAlive.

You could also just drop your shell script into /etc/periodic/daily.

larsks
  • 43,623
  • 14
  • 121
  • 180