Launchd to only run on schedule, not restart?

Discussion in 'Mac Programming' started by carterx, Mar 11, 2015.

  1. carterx macrumors member

    carterx

    Joined:
    Dec 4, 2006
    #1
    I have a script that I wan to set for 3:30am daily and it does run at the set time but it also runs on every restart of the computer which I do not want.

    How do I make this work with just the schedule in place and not run on every startup of the computer?

    Here's my plist:

    Code:
    <?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.xxxxx.xxxx</string>
        <key>ProgramArguments</key>
        <array>
            <string>/Library/Scripts/script.sh</string>
        </array>
        <key>StartCalendarInterval</key>
        <dict>
            <key>Minute</key>
            <integer>30</integer>
            <key>Hour</key>
            <integer>3</integer>
        </dict>
    </dict>
    </plist>
     
  2. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #2
    Does this occur every time or only when you have your computer tuned off at 3:30? If so that's an intended feature of StartCalendarInterval to not miss a scheduled job if the computer has been turned off. From the man page:

    There may be a key you can add to prevent this, I'm not aware of it though.
     

Share This Page