I'm trying to automatically execute a Python script every day, but it requires an Internet connection (to send emails, etc.). So I fixed the date and hour at which it needs to be executed, but if there's no network available, I want it to be executed as soon as it finds a network. I thought that the following would do just what I need:
<?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.example</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/python</string>
<string>/path/to/my/script.py</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>10</integer>
<key>Minute</key>
<integer>30</integer>
</dict>
<key>KeepAlive</key>
<dict>
<key>NetworkState</key>
<true/>
</dict>
</dict>
</plist>
It works fine when I have an Internet connection at 10:30, but when I don't have network available but only get it back at, say, 11:00, it does not execute the script and does nothing for the rest of the day.
What did I do wrong?
Many thanks,