From 0b300cf5f4afbebe51b3a40bae5e4e10e522e245 Mon Sep 17 00:00:00 2001 From: jenz Date: Wed, 11 Jan 2023 13:00:47 +0100 Subject: [PATCH] mitigated restarting by having timer launch another service that just restarts the actual service --- systemctl_launch_ze/css_ze.service | 6 +++--- systemctl_launch_ze/css_ze.timer | 9 --------- systemctl_launch_ze/css_ze_restart.service | 13 +++++++++++++ systemctl_launch_ze/css_ze_restart.timer | 9 +++++++++ 4 files changed, 25 insertions(+), 12 deletions(-) delete mode 100644 systemctl_launch_ze/css_ze.timer create mode 100644 systemctl_launch_ze/css_ze_restart.service create mode 100644 systemctl_launch_ze/css_ze_restart.timer diff --git a/systemctl_launch_ze/css_ze.service b/systemctl_launch_ze/css_ze.service index a5215cf9..c85deff2 100644 --- a/systemctl_launch_ze/css_ze.service +++ b/systemctl_launch_ze/css_ze.service @@ -1,12 +1,12 @@ [Unit] -Description=Runs the second ze server as user gameservers. +Description=Runs the ze server as user gameservers. After=network.target [Service] -Type=forking +Type=simple User=gameservers Group=gameservers -Environment=PATH=/usr/lib/jvm/jdk-17/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin: +Environment=PATH=/usr/lib/jvm/jdk-17/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin: WorkingDirectory=/home/gameservers/css_ze/ ExecStart=script -c "/home/gameservers/css_ze/srcds_run -game cstrike -pidfile srv_css_ze.pid -ip 135.125.188.157 -port 27015 +maxplayers 64 +fps_max 100 -tickrate 66 -timeout 0 +tv_port 27040 -insecure" /dev/null Restart=on-failure diff --git a/systemctl_launch_ze/css_ze.timer b/systemctl_launch_ze/css_ze.timer deleted file mode 100644 index 7414d1e3..00000000 --- a/systemctl_launch_ze/css_ze.timer +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Restarts ze server every odd night in month at 5:30 -Requires=css_ze.service - -[Timer] -OnCalendar=*-*-1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31 05:30:00 - -[Install] -WantedBy=multi-user.target diff --git a/systemctl_launch_ze/css_ze_restart.service b/systemctl_launch_ze/css_ze_restart.service new file mode 100644 index 00000000..325355b6 --- /dev/null +++ b/systemctl_launch_ze/css_ze_restart.service @@ -0,0 +1,13 @@ +[Unit] +Description=Restarts the ze servers systemctl service +After=network.target + +[Service] +Type=simple +User=root +Group=root +Environment=PATH=/usr/lib/jvm/jdk-17/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin: +ExecStart=/usr/bin/bash -c 'systemctl restart css_ze.service' + +[Install] +WantedBy=default.target diff --git a/systemctl_launch_ze/css_ze_restart.timer b/systemctl_launch_ze/css_ze_restart.timer new file mode 100644 index 00000000..6e43b124 --- /dev/null +++ b/systemctl_launch_ze/css_ze_restart.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Restarts the systemctl service for ze server every odd night in month at 5:30 +Requires=css_ze_restart.service + +[Timer] +OnCalendar=*-*-1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31 05:30:00 + +[Install] +WantedBy=multi-user.target