I'm working in a task to keep Mac application is always alive. I'm success to create a plist file to make app respawn when user force quite app from Dock or kill process from Activity Monitor
Here's my 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>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.mydaemon</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/MyApp.app/Contents/MacOS/MyApp</string>
<string>-runMode</string>
<string>ifneeded</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/tmp/LaunchAgentErr.stderr</string>
<key>StandardOutPath</key>
<string>/tmp/LaunchAgentOut.stdout</string>
<key>StartInterval</key>
<integer>1</integer>
</dict>
</plist>
However user still unload my daemon to stop my app by using:
launchctl bootout gui/501 Library/LaunchAgents/com.mydaemon.plist
My question is how to prevent user unload my daemon by using above command? Or is there any solution to trigger load automatically when daemon is unloaded?
Any help will be appreciated!