Start on boot with Mac as LaunchDaemon

Get help, report and discuss bugs.
Post Reply
epic
Posts: 2
Joined: 22 Sep 2017, 06:25

Start on boot with Mac as LaunchDaemon

Post by epic » 22 Sep 2017, 06:36

I am trying to start NZBGet when my Mac boots up rather than on user login. I've created the following plist and put it in /Library/LaunchDaemons.

Code: Select all

<?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>GroupName</key>
	<string>staff</string>
	<key>InitGroups</key>
	<true/>
	<key>Label</key>
	<string>local.nzbget</string>
	<key>ProgramArguments</key>
	<array>
		<string>/Applications/NZBGet.app/Contents/Resources/daemon/usr/local/bin/nzbget</string>
		<string>-s</string>
		<string>-o</string>
		<string>OutputMode=Log</string>
		<string>-c</string>
		<string>/Users/Epic/Library/Application Support/NZBGet/nzbget.conf</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
	<key>StandardErrorPath</key>
	<string>/tmp/local.nzbget.err</string>
	<key>StandardOutPath</key>
	<string>/tmp/local.nzbget.out</string>
	<key>UserName</key>
	<string>Epic</string>
</dict>
</plist>
However, I get the following error in /tmp/local.nzbget.out:

Code: Select all

[ERROR] Could not read configuration templates
[INFO] nzbget 19.1 server-mode
Then when I try to connect via the browser I get:

Code: Select all

Error: 503 Service Unavailable
I am using the same config file that I have been using using with the NZBGet.app, which I have no problems launching from the GUI or as a Login Item.

Any ideas on how to fix it?

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: Start on boot with Mac as LaunchDaemon

Post by hugbug » 22 Sep 2017, 06:52

The nzbget daemon executable needs options WebDir and ConfigTemplate. When the daemon is launched by the app these options are passed as command line parameters.

Start the app as usual, then use "ps -A" or other tool to find out which parameters were passed and add them to the start command of your plist-file.

epic
Posts: 2
Joined: 22 Sep 2017, 06:25

Re: Start on boot with Mac as LaunchDaemon

Post by epic » 22 Sep 2017, 07:15

Awesome. I copied the exact same parameters from ps like you suggested and it launched perfectly. Thank you!

pwstoneman
Posts: 1
Joined: 07 Jan 2018, 15:04

Re: Start on boot with Mac as LaunchDaemon

Post by pwstoneman » 07 Jan 2018, 15:11

This was amazingly helpful! Worked like on charm on my semi-headless Mac server. Copied the plist and followed the instructions to modify according to actual command passed as determined from ps.

Many thanks!

Post Reply

Who is online

Users browsing this forum: No registered users and 58 guests