1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2024-12-21 23:33:18 +00:00
4 Systemd service
ilike2burnthing edited this page 2023-01-08 07:54:50 +00:00

Using mono

To automatically start Jackett as a systemd service you have to create the following service file (e.g. /etc/systemd/system/jackett.service):

[Unit]
Description=Jackett Daemon
After=network.target

[Service]
WorkingDirectory=/opt/jackett/Jackett/
User=jackett
ExecStart=/usr/bin/mono --debug JackettConsole.exe --NoRestart
Restart=always
RestartSec=2
Type=simple
TimeoutStopSec=5
SyslogIdentifier=jackett

# These lines optionally isolate (sandbox) Jackett from the rest of the system.
#ReadWritePaths=/opt/jackett/Jackett
#ProtectSystem=strict
#PrivateDevices=true
#ProtectHome=true

[Install]
WantedBy=multi-user.target

Adjust the WorkingDirectory and User options in the Service section according to your install location and system user which is supposed to run Jackett. If you wish to run Jackett more isolated from the rest of the system, uncomment the sandboxing options and change the path to be the same as the WorkingDirectory path.

Jackett is started with the --NoRestart option (supported since v0.7.898) to prevent Jackett from restarting itself during updates. During updates Jackett will kill the old process and systemd will restart Jackett (Restart=always).

After saving the file you've to reload systemd using systemctl daemon-reload

Now you should be able to start/stop/restart the service using systemctl start/stop/restart jackett

To check the status use systemctl status jackett

To enable automatic startup on system boot run systemctl enable jackett

If there's a problem you can attach to the Jackett output using journalctl -fa -n 100 -u jackett

EDIT 30/10/2018: I found some extra line to make the mono process less aggressive on low powered system, so this is the script that I',m using for my system:

[Unit]
Description=Jackett Daemon
After=network.target

[Service]
Environment=MONO_THREADS_PER_CPU="250",MONO_GC_PARAMS="nursery-size=256m"
MemoryMax=300M #<-- THIS HAS TO BE CHANGED WITH YOUR VALUE
WorkingDirectory=/opt/Jackett/ #<-- THIS HAS TO BE CHANGED WITH YOUR VALUE
User=muletto #<-- THIS HAS TO BE CHANGED WITH YOUR VALUE
Group=muletto #<-- THIS HAS TO BE CHANGED WITH YOUR VALUE
UMask=0002
Restart=always
RestartSec=2
Type=simple
ExecStart=/usr/bin/mono --optimize=all /opt/Jackett/JackettConsole.exe --NoRestart #<-- THIS HAS TO BE CHANGED WITH YOUR VALUE
KillMode=process
TimeoutStopSec=20
SyslogIdentifier=jackett

[Install]
WantedBy=multi-user.target

Like the very first script you have to edit: User Group PATH of ExecStart and WorkingDirectory Then if you want to use more or less memory you have to edit the MemoryMax value

Not using mono

If you're not using mono, you may use this service file.

This service file is following up issue #11566 in which Jackett was not able to update properly. It is unclear if the changes made to this mono-less service file actually fixed the issue or not, but it remains a good starting point if you're setting up Jackett with systemd.

[Unit]
Description=Jackett Daemon
After=network.target

[Service]
SyslogIdentifier=jackett
Restart=always
Type=simple
User=jackett
Group=jackett
WorkingDirectory=/opt/Jackett
ExecStart=/bin/sh "/opt/Jackett/jackett_launcher.sh"

[Install]
WantedBy=multi-user.target