mirror of
https://github.com/SickGear/SickGear.git
synced 2025-03-02 10:55:02 +00:00
I have had a lot of issues with SickGear eating up every resource that I give to it. Most people are not going to be running SickGear on it's own dedicated hardware. While you can do a lot of resource management with virtualization, even then, I would imagine you're stacking other services with this. At one point, I was setting SickGear to restart nightly to keep the process from completely locking up my system. However, systemd has given us some pretty neat resources to handle this sort of stuff. I'm proposing we set a 50% CPU quota on SickGear, as it helps keep resources freed for other processes. If the user wants to dedicate all resources, then they have the option of changing the service file. However, this sets a pretty good precedent for resource allocation. For now, I'm only setting a CPU quota, however, there are FAR MORE options in case we want to further manage the resources which SickGear can use. https://www.freedesktop.org/software/systemd/man/systemd.resource-control.html
60 lines
2.1 KiB
Text
Executable file
60 lines
2.1 KiB
Text
Executable file
# Sickbeard systemd service unit file
|
|
#
|
|
# Configuration Notes
|
|
#
|
|
# - Option names (e.g. ExecStart=, Type=) are case-sensitive)
|
|
#
|
|
# - Adjust User= and Group= to the user/group you want SickGear to run as.
|
|
#
|
|
# - Optional adjust EnvironmentFile= path to configuration file
|
|
# Can ONLY be used for configuring extra options used in ExecStart.
|
|
# Putting a minus (-) in front of file means no error warning if the file doesn't exist
|
|
#
|
|
# - Adjust ExecStart= to point to your python and SickGear executables.
|
|
# The FIRST token of the command line must be an ABSOLUTE FILE NAME,
|
|
# then followed by arguments for the process.
|
|
# If no --datadir is given, data is stored in same dir as SickBeard.py
|
|
# Arguments can also be set in EnvironmentFile (except python)
|
|
#
|
|
# - WantedBy= specifies which target (i.e. runlevel) to start SickGear for.
|
|
# multi-user.target equates to runlevel 3 (multi-user text mode)
|
|
# graphical.target equates to runlevel 5 (multi-user X11 graphical mode)
|
|
#
|
|
|
|
### Example Using SickGear as daemon with pid file
|
|
# Type=forking
|
|
# PIDFile=/var/run/sickgear/sickgear.pid
|
|
# ExecStart=/usr/bin/python /opt/sickgear/SickBeard.py -q --daemon --nolaunch --pidfile=/var/run/sickgear/sickgear.pid --datadir=/opt/sickgear
|
|
|
|
## Example Using SickGear as daemon without pid file
|
|
# Type=forking
|
|
# GuessMainPID=no
|
|
# ExecStart=/usr/bin/python /opt/sickgear/SickBeard.py -q --daemon --nolaunch --datadir=/opt/sickgear
|
|
|
|
### Example Using simple
|
|
# Type=simple
|
|
# ExecStart=/usr/bin/python /opt/sickgear/SickBeard.py -q --nolaunch
|
|
|
|
### Example Using simple with EnvironmentFile where SB_DATA=/home/sickgear/.sickgear in /etc/sickgear.conf
|
|
# Type=simple
|
|
# EnvironmentFile=/etc/sickgear.conf
|
|
# ExecStart=/usr/bin/python /opt/sickgear/SickBeard.py -q --nolaunch --datadir=${SB_DATA}
|
|
|
|
### Configuration
|
|
|
|
[Unit]
|
|
Description=SickGear Daemon
|
|
|
|
[Service]
|
|
User=sickgear
|
|
Group=sickgear
|
|
|
|
Type=forking
|
|
GuessMainPID=no
|
|
ExecStart=/usr/bin/python /opt/sickgear/SickBeard.py -q --daemon --nolaunch --datadir=/opt/sickgear
|
|
|
|
CPUAccounting=true
|
|
CPUQuota=50%
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|