Change to user service files

This commit is contained in:
Marco Cawthorne 2023-11-18 16:07:09 -08:00
parent 2123ee319b
commit 0207013b81
Signed by: eukara
GPG key ID: CE2032F0A2882A22
7 changed files with 32 additions and 31 deletions

View file

@ -5,5 +5,5 @@ systemctl disable freehl
find ./ -type f -name "server.cfg" -print | while read LINE find ./ -type f -name "server.cfg" -print | while read LINE
do do
GAMEDIR=$(dirname "$LINE" | cut -d '/' -f 2) GAMEDIR=$(dirname "$LINE" | cut -d '/' -f 2)
echo systemctl disable freehl@$GAMEDIR systemctl --user disable freehl@$GAMEDIR
done done

View file

@ -1,4 +1,9 @@
#!/bin/sh #!/bin/sh
systemctl enable freehl systemctl --user enable freehl
systemctl enable freehl@
find ./ -type f -name "server.cfg" -print | while read LINE
do
GAMEDIR=$(dirname "$LINE" | cut -d '/' -f 2)
systemctl --user enable freehl@$GAMEDIR
done

View file

@ -6,17 +6,9 @@ ExecReload=/bin/kill $MAINPID
KillMode=process KillMode=process
Restart=on-failure Restart=on-failure
; You want to adjust these for your user, this example assumes debian ; You want to adjust these for your setup
User=debian WorkingDirectory=%h/halflife/
Environment="HOME=/home/debian" ExecStart=%h/halflife/fteqw-sv64 -halflife
WorkingDirectory=/home/debian/halflife/
ExecStart=/home/debian/halflife/fteqw-sv64 -halflife
PrivateTmp=true
ProtectHome=false
ProtectSystem=full
PrivateDevices=false
CapabilityBoundingSet=~CAP_SYS_ADMIN
[Install] [Install]
WantedBy=multi-user.target WantedBy=default.target

View file

@ -6,17 +6,9 @@ ExecReload=/bin/kill $MAINPID
KillMode=process KillMode=process
Restart=on-failure Restart=on-failure
; You want to adjust these for your user, this example assumes debian ; You want to adjust these for your setup
User=debian WorkingDirectory=%h/halflife/
Environment="HOME=/home/debian" ExecStart=%h/halflife/fteqw-sv64 -halflife -game %i
WorkingDirectory=/home/debian/halflife/
ExecStart=/home/debian/halflife/fteqw-sv64 -halflife -game %i
PrivateTmp=true
ProtectHome=false
ProtectSystem=full
PrivateDevices=false
CapabilityBoundingSet=~CAP_SYS_ADMIN
[Install] [Install]
WantedBy=multi-user.target WantedBy=default.target

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
SERVICE_DIR="/etc/systemd/system" SERVICE_DIR="/etc/systemd/user"
find ./ -type f -name '*.service' -print | while read LINE find ./ -type f -name '*.service' -print | while read LINE
do do

View file

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

13
stop-services.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/sh
systemctl --user restart freehl
find ./ -type f -name "server.cfg" -print | while read LINE
do
GAMEDIR=$(dirname "$LINE" | cut -d '/' -f 2)
if [ "$GAMEDIR" != "valve" ]
then
systemctl --user restart freehl@$GAMEDIR
fi
done