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