This DayZ Watchdog script to check server availability
With the release of DayZ 1.24, a server for Linux appeared, this is undoubtedly very cool, but the implementation was in an experimental state for a very long time, which is why some problems crop up when trying to run modified community servers.
At the time of writing, there was a problem with the scheduled restart of the modified server based on an event from messages.xml
. Details at https://feedback.bistudio.com/T179734
Important
These are instructions for a non-system user; for a root user you can adapt them yourself if necessary
Note
List of system utilities required for work, make sure that all are available on your system
nc
, stat
, grep
(GNU), date
, systemctl
, cut
, sleep
mkdir -p ~/.local/bin/
curl -#SfLo ~/.local/bin/dayz-watchdog \
https://gist.githubusercontent.com/WoozyMasta/3c3aaf8d1b1517e9ee47c6b2a96fee96/raw/dayz-watchdog
chmod +x ~/.local/bin/dayz-watchdog
Let's check that ~/.local/bin
is in PATH and if not add it
[[ ":$PATH:" != *":$HOME/.local/bin:"* ]] && \
printf '\n#[ -d "$HOME/.local/bin" ] && PATH="$HOME/.local/bin:$PATH"\n' >> ~/.profile
Let's run it once, as arguments we pass all the names of systemd services that we will check
dayz-watchdog dayz-server.service
Download systemd service and timer
mkdir -p ~/.config/systemd/user/
curl -#SfLo ~/.config/systemd/user/dayz-watchdog.service \
https://gist.githubusercontent.com/WoozyMasta/3c3aaf8d1b1517e9ee47c6b2a96fee96/raw/dayz-watchdog.service
curl -#SfLo ~/.config/systemd/user/dayz-watchdog.timer \
https://gist.githubusercontent.com/WoozyMasta/3c3aaf8d1b1517e9ee47c6b2a96fee96/raw/dayz-watchdog.timer
Edit arguments in ExecStart=
property
editor ~/.config/systemd/user/dayz-watchdog.service
Edit scheduller in OnCalendar=
property, default is every minute
editor ~/.config/systemd/user/dayz-watchdog.service
Enable and start timer
systemctl --user daemon-reload
systemctl --user start dayz-watchdog.timer
systemctl --user enable dayz-watchdog.timer
systemctl --user status dayz-watchdog.service
journalctl --user -eu dayz-watchdog