systemd: Sync pyrobud unit with recommended settings

Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
This commit is contained in:
Harsh Shandilya 2019-12-23 18:05:11 +05:30
parent c9b2bf0ad8
commit cf54c33870
No known key found for this signature in database
GPG key ID: C2E74282C2133D62

View file

@ -1,20 +1,35 @@
[Unit]
Description=Pyrobud Telegram userbot service
After=network.target
Description=Pyrobud Telegram selfbot
After=multi-user.target
[Service]
Restart=on-abort
# Base settings
Type=simple
User=bot
WorkingDirectory=/home/bot/pyrobud
ExecStart=/home/bot/pyrobud/venv/bin/python main.py
ExecReload=/bin/kill -USR1 $MAINPID
KillMode=mixed
KillSignal=SIGQUIT
TimeoutStopSec=5s
Restart=always
RestartSec=10
# Execution parameters
User=pyrobud
Group=pyrobud
WorkingDirectory=/home/pyrobud/pyrobud
ExecStart=/home/pyrobud/venv/bin/python -O /home/pyrobud/pyrobud/main.py
# Limit damage in case something goes awry
MemoryLimit=256M
CPUQuota=200%
# Security
PrivateTmp=true
PrivateDevices=false
ProtectSystem=full
NoNewPrivileges=true
ProtectControlGroups=true
ProtectKernelModules=true
ProtectKernelTunables=true
PrivateDevices=true
RestrictAddressFamilies=AF_INET AF_INET6
RestrictNamespaces=true
RestrictRealtime=true
SystemCallArchitectures=native
[Install]
WantedBy=multi-user.target