diff --git a/control.sh b/control.sh new file mode 100644 index 0000000..35be5ef --- /dev/null +++ b/control.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +# +# Serververwaltung für STRAWBERRY-ROLEPLAY +# (C) 2021 by bithost GbR +# + +PS3='Was möchtest du machen? ' +options=("Server starten" "Server stoppen" "Server neustarten" "Abbruch") +select opt in "${options[@]}" +do + case $opt in + "Server starten") + echo "Server wird gestartet..." + tmux new -n fxserver '/home/fx-server/run.sh +set onesync on +set onesync_population false +exec server.cfg' + break + ;; + "Server stoppen") + echo "Server wird gestoppt" + tmux send-keys -t fxserver.0 'quit' ENTER + break + ;; + "Server neustarten") + echo "Server wird neugestartet" + tmux send-keys -t fxserver.0 say' [SRP] Automatischer Neustart in 180 Sekunden!' ENTER + sleep 120 + tmux send-keys -t fxserver.0 say' [SRP] Automatischer Neustart in 60 Sekunden!' ENTER + sleep 40 + tmux send-keys -t fxserver.0 say' [SRP] Automatischer Neustart in 30 Sekunden!' ENTER + sleep 20 + + COUNT=10 + while [ $COUNT -gt 0 ]; do + tmux send-keys -t fxserver.0 say' [SRP] Automatischer Neustart in ' $COUNT ' Sekunden!' ENTER + let COUNT=COUNT-1 + sleep 1 + done + + tmux send-keys -t fxserver.0 'quit' ENTER + + tmux send-keys -t fxserver.0 '/home/fx-server/run.sh +set onesync on +set onesync_population false +exec server.cfg' ENTER + break + ;; + "Abbruch") + break + ;; + *) echo "Unbekannte Eingabe $REPLY";; + esac +done \ No newline at end of file