-
All replies
-
Helpful answers
-
Jun 24, 2016 2:36 PM in response to kobayashi maruby Barney-15E,To start, I don't know how to do what you want.
However, do you need to do some configuration when you restart it or can it just restart and is ready to go?
If the latter, you can launch it with a LaunchAgent and tell it to keep the process alive. Then, if it crashes, it should restart the app automatically.
Here is an example plist that Apple used to use for Spotlight:
<?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.apple.Spotlight</string>
<key>ProgramArguments</key>
<array>
<string>/System/Library/CoreServices/Spotlight.app/Contents/MacOS/Spotlight</string>
</array>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
Note that you must set the path all the way into the App bundle.
I highlighted the parts that you need to change in your own. The current Spotlight plist is a little more complicated.
Here is some info on all the parameters and where you should put the plist file depending on when you want it to start: A launchd Tutorial
A LaunchAgent runs at login and a LaunchDaemon runs at system startup. Your program would have to be able to run without a user login to be made as a LaunchDaemon.