From a283c7afdf0fc9c094f59b5d706287e00cb78b6b Mon Sep 17 00:00:00 2001 From: Niels Peretzke Date: Tue, 14 Dec 2021 23:06:43 +0100 Subject: [PATCH] =?UTF-8?q?Variablen=20eingef=C3=BCgt=20f=C3=BCr=20leichte?= =?UTF-8?q?re=20=C3=84nderungen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- control.sh | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/control.sh b/control.sh index 35be5ef..066a8ae 100644 --- a/control.sh +++ b/control.sh @@ -1,8 +1,12 @@ #!/usr/bin/env bash # -# Serververwaltung für STRAWBERRY-ROLEPLAY +# Einfaches Start/Stopp/Restart Script # (C) 2021 by bithost GbR # +### START CONFIG ### +INSTANCE_NAME='fxserver' +START_CMD='/home/fx-server/run.sh +set onesync on +set onesync_population false +exec server.cfg' +### END CONFIG - DO NOT EDIT BELOW THIS MESSAGE!!! ### PS3='Was möchtest du machen? ' options=("Server starten" "Server stoppen" "Server neustarten" "Abbruch") @@ -11,38 +15,38 @@ 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' + tmux new -n $INSTANCE_NAME $START_CMD break ;; "Server stoppen") echo "Server wird gestoppt" - tmux send-keys -t fxserver.0 'quit' ENTER + tmux send-keys -t $INSTANCE_NAME.0 'quit' ENTER break ;; "Server neustarten") echo "Server wird neugestartet" - tmux send-keys -t fxserver.0 say' [SRP] Automatischer Neustart in 180 Sekunden!' ENTER + tmux send-keys -t $INSTANCE_NAME.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 + tmux send-keys -t $INSTANCE_NAME.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 + tmux send-keys -t $INSTANCE_NAME.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 + tmux send-keys -t $INSTANCE_NAME.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 $INSTANCE_NAME.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 + tmux send-keys -t $INSTANCE_NAME.0 $START_CMD ENTER break ;; "Abbruch") break ;; - *) echo "Unbekannte Eingabe $REPLY";; + *) echo "Unbekannte Eingabe: $REPLY";; esac done \ No newline at end of file