Last active
February 18, 2020 13:56
-
-
Save fionn/a9e036cfed4994c3c3de0e74dd775da4 to your computer and use it in GitHub Desktop.
Systemd service unit templates for bots
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# symlink to /etc/systemd/system/ | |
[Unit] | |
Description=%I bot | |
After=network.target | |
[Service] | |
Type=simple | |
WorkingDirectory=/home/fionn/bots/%i/ | |
EnvironmentFile=/home/fionn/bots/%i/.env | |
ExecStart=/home/fionn/bots/%i/venv/bin/python -u src/main.py | |
Restart=on-failure | |
RestartSec=900 | |
DynamicUser=true | |
PrivateDevices=true | |
ProtectHostname=true | |
ProtectKernelTunables=true | |
ProtectKernelModules=true | |
ProtectControlGroups=true | |
SystemCallArchitectures=native | |
LockPersonality=true | |
MemoryDenyWriteExecute=true | |
InaccessiblePaths=/dev /boot | |
RestrictRealtime=true | |
PrivateMounts=true | |
MountFlags=private | |
PrivateUsers=true | |
UMask=0777 | |
RestrictAddressFamilies=AF_INET AF_INET6 | |
RestrictNamespaces=yes | |
CapabilityBoundingSet= | |
AmbientCapabilities= | |
SystemCallFilter=@system-service | |
SystemCallFilter=~@privileged @resources | |
ProtectKernelLogs=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# symlink to /etc/systemd/system/ | |
[Unit] | |
Description=%I bot timer | |
[Timer] | |
OnCalendar=*:0/10 | |
[Install] | |
WantedBy=timers.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment