Simplify systemd service files

This commit is contained in:
Marco Cawthorne 2023-11-18 15:56:43 -08:00
parent c86e361b6f
commit 3a2383a524
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
10 changed files with 10 additions and 146 deletions

9
enable-services.sh Executable file → Normal file
View File

@ -1,9 +1,4 @@
#!/bin/sh
SERVICE_DIR="/etc/systemd/system"
find ./ -type f -name '*.service' -print | while read LINE
do
FILE=$(basename "$LINE" | cut -d '.' -f 1)
systemctl enable "$FILE"
done
systemctl enable freehl
systemctl enable freehl@

View File

@ -1,22 +0,0 @@
[Unit]
Description=FreeHL-CStrike
[Service]
ExecReload=/bin/kill $MAINPID
KillMode=process
Restart=on-failure
; You want to adjust these for your user, this example assumes debian
User=debian
Environment="HOME=/home/debian"
WorkingDirectory=/home/debian/halflife/
ExecStart=/home/debian/halflife/fteqw-sv64 -halflife -game cstrike
PrivateTmp=true
ProtectHome=false
ProtectSystem=full
PrivateDevices=false
CapabilityBoundingSet=~CAP_SYS_ADMIN
[Install]
WantedBy=multi-user.target

View File

@ -1,22 +0,0 @@
[Unit]
Description=FreeHL-Gearbox
[Service]
ExecReload=/bin/kill $MAINPID
KillMode=process
Restart=on-failure
; You want to adjust these for your user, this example assumes debian
User=debian
Environment="HOME=/home/debian"
WorkingDirectory=/home/debian/halflife/
ExecStart=/home/debian/halflife/fteqw-sv64 -halflife -game gearbox
PrivateTmp=true
ProtectHome=false
ProtectSystem=full
PrivateDevices=false
CapabilityBoundingSet=~CAP_SYS_ADMIN
[Install]
WantedBy=multi-user.target

View File

@ -1,22 +0,0 @@
[Unit]
Description=FreeHL-Hunger
[Service]
ExecReload=/bin/kill $MAINPID
KillMode=process
Restart=on-failure
; You want to adjust these for your user, this example assumes debian
User=debian
Environment="HOME=/home/debian"
WorkingDirectory=/home/debian/halflife/
ExecStart=/home/debian/halflife/fteqw-sv64 -halflife -game hunger
PrivateTmp=true
ProtectHome=false
ProtectSystem=full
PrivateDevices=false
CapabilityBoundingSet=~CAP_SYS_ADMIN
[Install]
WantedBy=multi-user.target

View File

@ -1,22 +0,0 @@
[Unit]
Description=FreeHL-Rewolf
[Service]
ExecReload=/bin/kill $MAINPID
KillMode=process
Restart=on-failure
; You want to adjust these for your user, this example assumes debian
User=debian
Environment="HOME=/home/debian"
WorkingDirectory=/home/debian/halflife/
ExecStart=/home/debian/halflife/fteqw-sv64 -halflife -game rewolf
PrivateTmp=true
ProtectHome=false
ProtectSystem=full
PrivateDevices=false
CapabilityBoundingSet=~CAP_SYS_ADMIN
[Install]
WantedBy=multi-user.target

View File

@ -1,22 +0,0 @@
[Unit]
Description=FreeHL-Scihunt
[Service]
ExecReload=/bin/kill $MAINPID
KillMode=process
Restart=on-failure
; You want to adjust these for your user, this example assumes debian
User=debian
Environment="HOME=/home/debian"
WorkingDirectory=/home/debian/halflife/
ExecStart=/home/debian/halflife/fteqw-sv64 -halflife -game scihunt
PrivateTmp=true
ProtectHome=false
ProtectSystem=full
PrivateDevices=false
CapabilityBoundingSet=~CAP_SYS_ADMIN
[Install]
WantedBy=multi-user.target

View File

@ -1,22 +0,0 @@
[Unit]
Description=FreeHL-TFC
[Service]
ExecReload=/bin/kill $MAINPID
KillMode=process
Restart=on-failure
; You want to adjust these for your user, this example assumes debian
User=debian
Environment="HOME=/home/debian"
WorkingDirectory=/home/debian/halflife/
ExecStart=/home/debian/halflife/fteqw-sv64 -halflife -game tfc
PrivateTmp=true
ProtectHome=false
ProtectSystem=full
PrivateDevices=false
CapabilityBoundingSet=~CAP_SYS_ADMIN
[Install]
WantedBy=multi-user.target

View File

@ -1,5 +1,5 @@
[Unit]
Description=FreeHL-Valve
Description=FreeHL
[Service]
ExecReload=/bin/kill $MAINPID

View File

@ -1,5 +1,5 @@
[Unit]
Description=FreeHL-DMC
Description=FreeHL-%I
[Service]
ExecReload=/bin/kill $MAINPID
@ -10,7 +10,7 @@ Restart=on-failure
User=debian
Environment="HOME=/home/debian"
WorkingDirectory=/home/debian/halflife/
ExecStart=/home/debian/halflife/fteqw-sv64 -halflife -game dmc
ExecStart=/home/debian/halflife/fteqw-sv64 -halflife -game %i
PrivateTmp=true
ProtectHome=false

View File

@ -1,9 +1,10 @@
#!/bin/sh
SERVICE_DIR="/etc/systemd/system"
systemctl restart freehl
find ./ -type f -name '*.service' -print | while read LINE
find ./ -type f -name "server.cfg" -print | while read LINE
do
FILE=$(basename "$LINE" | cut -d '.' -f 1)
systemctl restart "$FILE"
GAMEDIR=$(dirname "$LINE" | cut -d '/' -f 2)
echo systemctl restart freehl@$GAMEDIR
##systemctl restart "$FILE"
done