Last active
August 29, 2015 14:04
-
-
Save inertia186/bab78fe5b651b4606a3e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Cleanly recovers from a crash event. | |
| IFS=$'\n' | |
| MC="/Users/steve/Minecraft" | |
| LOG="$MC/logs/latest.log" | |
| ALERT="$MC/scripts/alert-admin.sh" | |
| error="$2" | |
| if [ -n "$error" ]; then | |
| path="`echo "$error" | cut -f 8 -d " "`" | |
| reason="`cat "$path" | grep Exception | cut -f 2 -d ":"`" | |
| fi | |
| if [ -z "$reason" ]; then | |
| $ALERT "Crash recovery engaged." WARN | |
| else | |
| $ALERT "Crash recovery engaged:$reason" WARN | |
| fi | |
| IFS=$' ' | |
| for player in `$MC/scripts/playerlist.sh` | |
| do | |
| if [ -z "$reason" ]; then | |
| $MC/scripts/kick.sh $player "Crash recovery engaged." | |
| else | |
| $MC/scripts/kick.sh $player "Crash recovery engaged:$reason" | |
| fi | |
| done | |
| IFS=$'\n' | |
| $MC/scripts/save-all.sh down | |
| $MC/scripts/rcon.sh save-on | |
| $MC/scripts/rcon.sh stop | |
| sleep 15 | |
| $MC/start.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment