Zway-Bot/Zway-Bot/control/control.sh

92 lines
1.6 KiB
Bash

#!/bin/bash
# Read Settings
DIR=`dirname $0`
source $DIR/settings.cfg
cd $control_root
for(( ; ; ))
do
# Test for Running Servers
servers=$(./view.sh | grep $screen_name)
clear
if [[ -z $servers ]];
then
echo "Zway-Bot not Running!"
echo ""
echo "1) Start Zway-Bot"
else
echo "Zway-Bot is Running :)"
echo ""
echo "2) Stop Zway-Bot"
echo "3) Restart Zway-Bot"
echo "4) Attach to Servers Screen-Session"
echo "5) Put Command to Zway-Bot"
fi
echo "q) Quit"
echo ""
read -p "Choice: " choice
case "$choice" in
q) #Quit
exit 0
;;
1) #Start Server
if [[ -z $servers ]];
then
echo "Starting Zway-Bot..."
./start.sh
else
echo "Zway-Bot Allready started!"
fi
;;
2) #Stop Server
if [[ -z $servers ]];
then
echo "Zway-Bot is not Running!"
else
echo "Stopping Zway-Bot..."
./stop.sh
fi
;;
3) #Restart Server
if [[ -z $servers ]];
then
echo "Zway-Bot is not Running!"
else
echo "Restarting Zway-Bot..."
./restart.sh
fi
;;
4) #Attach to Screen
if [[ -z $servers ]];
then
echo "Zway-Bot is not Running!"
else
./join.sh
fi
;;
5) #Put Command to Server
if [[ -z $servers ]];
then
echo "Zway-Bot is not Running!"
else
read -p "Please enter Zway-Bot-Command: " mc_cmd
./stuff.sh "$mc_cmd"
fi
;;
*) #Invalid Selection
echo "Wrong Selection!"
;;
esac
done