Einfaches Tool um verschiedene Tasks in handlicher Form anbieten zu können
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

52 lines
1.7 KiB

#!/usr/bin/env bash
#
# 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")
select opt in "${options[@]}"
do
case $opt in
"Server starten")
echo "Server wird gestartet..."
tmux new -d -n $INSTANCE_NAME $START_CMD
break
;;
"Server stoppen")
echo "Server wird gestoppt"
tmux send-keys -t $INSTANCE_NAME.0 'quit' ENTER
break
;;
"Server neustarten")
echo "Server wird neugestartet"
tmux send-keys -t $INSTANCE_NAME.0 say' [SRP] Automatischer Neustart in 180 Sekunden!' ENTER
sleep 120
tmux send-keys -t $INSTANCE_NAME.0 say' [SRP] Automatischer Neustart in 60 Sekunden!' ENTER
sleep 40
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 $INSTANCE_NAME.0 say' [SRP] Automatischer Neustart in ' $COUNT ' Sekunden!' ENTER
let COUNT=COUNT-1
sleep 1
done
tmux send-keys -t $INSTANCE_NAME.0 'quit' ENTER
tmux new -d -n $INSTANCE_NAME $START_CMD
break
;;
"Abbruch")
break
;;
*) echo "Unbekannte Eingabe: $REPLY";;
esac
done