I just upgraded from Ubuntu server 14 to version 15. I had trouble getting my upstart script working after the upgrade, and read that systemd is the new default. I'm far from a linux expert, so please go easy on me :-)
Here is what my upstart script was before:
description "NZBGet upstart script"
setuid robert
setgid robert
start on runlevel [2345]
stop on runlevel [016]
respawn
expect fork
script
exec nzbget -D
end script
pre-stop script
exec nzbget -Q
end script
Based on the upstart to systemd wiki page, I used the tables provided there to map things as closely as I could in my new systemd service file:
[Unit]
Description=NZBGet Service
[Service]
Type=forking
ExecStart=/usr/local/bin/nzbget -D
ExecStop=/usr/local/bin/nzbget -Q
Restart=on-failure
This file is located at /home/robert/.config/systemd/user/nzbget.service
. To start the service manually, I've been doing:
$ systemctl --user start nzbget
This works great. However, when I log out of my SSH session, the service shuts down. Also, it does not start on bootup or user login. I want it to behave the same as it did as an upstart service: I want it to start at boot, run constantly, and as a specific user.
What do I need to do to get this configuration?