-
Notifications
You must be signed in to change notification settings - Fork 47
macOS service
Muratcan Simsek edited this page Jan 10, 2017
·
2 revisions
You can create a macOS service with launchd. It will keep NZBHydra alive and will start the program at boot. To do this, create this file from the terminal:
nano ~/Library/LaunchAgents/com.theotherp.nzbhydra.plist
You can copy this inside, but do not forget to change the Python path. The one I used here is Homebrew's Python, which offers better performance and compatibility. No need to change if you also use it.
You will also need to change nzbhydra.py path to yours.
<?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.theotherp.nzbhydra</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/python</string>
<string>/Users/<USER>/Applications/nzbhydra/nzbhydra.py</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardErrorPath</key>
<string>/Users/msimsek/Applications/nzbhydra/nzbhydra-launchd.log</string>
<key>StandardOutPath</key>
<string>/Users/msimsek/Applications/nzbhydra/nzbhydra-launchd.log</string>
</dict>
</plist>
If you don't want to run NZBHydra at boot, change RunAtLoad to false. Same thing for KeepAlive.
To load the service enter this command, it will not start NZBHydra if you set RunAtLoad to false:
launchctl load ~/Library/LaunchAgents/com.theotherp.nzbhydra.plist
To unload it:
launchctl unload ~/Library/LaunchAgents/com.theotherp.nzbhydra.plist
As a final note, do not forget to enable Shutdown to restart from NZBHydra's config if you choose to use KeepAlive.