Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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!

share|improve this question

1 Answer 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.

share|improve this answer
    
That just might do it. thanks for the help. :) –  davethegr8 Nov 19 '10 at 4:31
    
If you are happy with this answer would you mind accepting it? Thanks! –  larsks Nov 19 '10 at 14:12
    
of course, once I make sure it's working. ;) –  davethegr8 Nov 19 '10 at 16:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.