I tried using the StartInterval and ThrottleInterval. It starts up but to soon which conflicts with another application I am running that is why I wanted to run a delay on this.
This is the example of my runnign plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.connector.agent</string>
<key>RunAtLoad</key>
<true/>
<key>ThrottleInterval</key>
<integer>60</integer>
<key>KeepAlive</key>
<key>SuccessfulExit</key>
<false />
</dict>
<key>ProgramArguments</key>
<array>
<string>/Applications/Connector.app/Contents/MacOS/Connector</string>
<string>-agent</string>
</array>
</dict>
</plist>
Adding arbitrary delays like this is almost always a bad idea. What happens if the other process takes a long time to start up because, say, it makes a network request and the network is slow today? It’s generally better to use some sort of dependency check rather than just delay and hope.
Regardless, to answer your specific question there’s no way to tell
launchd
to delay the start of your agent. However, there’s nothing stopping you from adding your own delay. You’re already passing the
-agent
argument to your agent, so it knows it’s running in agent mode, and thus it can just add a delay to the start of
main
.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"