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.
This commit is contained in:
Clarth 2024-01-23 13:46:40 -05:00
parent 29e1755efa
commit 9adf5e080f
1 changed files with 11 additions and 0 deletions

View File

@ -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