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-watchdogLet'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' >> ~/.profileLet's run it once, as arguments we pass all the names of systemd services that we will check
dayz-watchdog dayz-server.serviceDownload 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.timerEdit arguments in ExecStart= property
editor ~/.config/systemd/user/dayz-watchdog.serviceEdit scheduller in OnCalendar= property, default is every minute
editor ~/.config/systemd/user/dayz-watchdog.serviceEnable 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