diff --git a/Autostart-on-Linux.md b/Autostart-on-Linux.md index e14f7c5..018203c 100644 --- a/Autostart-on-Linux.md +++ b/Autostart-on-Linux.md @@ -1,4 +1,42 @@ -### Method 1: Upstart (Ubuntu based distros prior to 16.04) +## Systemd + +Most modern Linux distributions have switched to systemd, which involves a simple service file which gets enabled and started. + +### Service File +Be sure to change the `User`, `Group` and path for both `mono` and `Radarr.exe` to match your installation. The file should be named `radarr.service` and the best place for it is `/etc/systemd/system/`. Alternative locations like `/usr/lib/systemd/system/` and `/lib/systemd/system/` may depend on the distribution used. + +``` +[Unit] +Description=Radarr Daemon +After=syslog.target network.target + +[Service] +User=user +Group=group + +Type=simple +ExecStart=/usr/bin/mono /usr/lib/radarr/Radarr.exe -nobrowser +TimeoutStopSec=20 +KillMode=process +Restart=on-failure + +[Install] +WantedBy=multi-user.target +``` + +### Enable and Start Radarr + systemctl enable radarr.service + systemctl start radarr.service + +### Check Radarr Status + systemctl status radarr.service + + +If Radarr does not restart after an update, add the following to your systemd service unit: + + ExecStop=-/usr/bin/mono /tmp/radarr_update/Radarr.Update.exe "ps aux | grep Radarr | grep -v grep | awk '{ print $2 }'" /tmp/radarr_update /opt/Radarr/Radarr.exe + +## Upstart (Ubuntu prior to 16.04) Using Upstart allows for more advanced features, such as start/stop and automatic restart if it crashes. **Create the Radarr Upstart config file** @@ -200,62 +238,6 @@ on reboot i did notice it took a couple more seconds to login this is because th I cannot guarantee this will work but it seems to be working for me i am Linux newbie and this took me a while to figure out so hopefully by posting here it will help someone else avoid the trouble i went through -## Systemd - -Modern Linux systems have been updated to use the new systemd standard. The method is very simple and involves creating a service file then enabling it. - -**Create the service file** - -Be sure to modify the user, group, mono path and install directory. -```bash -cat > radarr.service << EOF -[Unit] -Description=Radarr Daemon -After=syslog.target network.target - -[Service] -User=username -Group=group - -Type=simple -ExecStart= -nobrowser -TimeoutStopSec=20 -KillMode=process -Restart=on-failure - -[Install] -WantedBy=multi-user.target -EOF -``` - -**Move the file to your systemd system directory** - -Typically located in `/usr/lib/systemd/system/`, **verify before proceeding**. Will differ based on distribution. -For Ubuntu 16.04 it's `/lib/systemd/system/`. - -```bash -mv radarr.service /usr/lib/systemd/system/ -``` - -**Add Radarr to startup** - -```bash -systemctl enable radarr.service -``` - -**Start Radarr service** - -Start radarr via systemd and verify status. - -```bash -systemctl start radarr.service -systemctl status radarr.service -``` - -If Radarr does not restart after an update, add the following to your systemd service unit: - -```ExecStop=-/usr/bin/mono /tmp/radarr_update/Radarr.Update.exe "ps aux | grep Radarr | grep -v grep | awk '{ print $2 }'" /tmp/radarr_update /opt/Radarr/Radarr.exe``` - ### FreeBSD/FreeNAS ### https://raw.github.com/tofagerl/freedrone/master/nzbdrone