The script uses the Net::SRCDS::Queries Perl module by Author MASANORIH to communicate with the SRCDS servers.

It checks if the servers responds to Source Server Queries, when the server does not respond to the queries, the script considers the server as unreachable/offline. When the server is considered unreachable/offline, the script uses normal bash commands to write a line with unreachable into a file. After the script wrote the line to the file it checks how many lines with unreachable have been written to the file. If five lines or more have been written to the file, the configured restart script/commands will be executed.

That’s all the script does. Simple but effective, right? :D

Below I embeded the Gist with the script, but keep in mind that I may forget to update the gist with the latest version of the script when I make changes to it.

Please check the galexrt/gameserver-scripts repository for the latest version of the script. In repo directory at srcds-restarter/.