From 9adf5e080fb865eb44f7e6edd553035db1179480 Mon Sep 17 00:00:00 2001 From: Clarth Date: Tue, 23 Jan 2024 13:46:40 -0500 Subject: [PATCH] Add Minecraft/Modded/mccheck.sh Checks if the server is running. Starts server if not running. Set a cron job for every ~5min Systemd would work better but limits console access to RCON. --- Minecraft/Modded/mccheck.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Minecraft/Modded/mccheck.sh diff --git a/Minecraft/Modded/mccheck.sh b/Minecraft/Modded/mccheck.sh new file mode 100644 index 0000000..ca0956c --- /dev/null +++ b/Minecraft/Modded/mccheck.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +if pgrep -u moddedmc java > /dev/null +then + echo "Java process is running for user 'moddedmc'" +else + echo "NO Java process running for user 'moddedmc'" + echo "MCcheck.sh found that user moddedmc didnt have a java process running and will attempt to restart the server." >> /home/moddedmc/script.log + bash /home/moddedmc/restartserver.sh +fi +exit \ No newline at end of file