I hope I have found the perfect place for my problem ...
I have a dedicated server with some minecraftservers (java) which are connected via a Bungeecord on it.
These all have a start.sh which looks in its folder like this:
screen -A -m -d -S SERVERNAME java -jar -Xmx2048M -Xms2048M spigot.jar
The stop.sh looks like this:
screen -S SERVERNAME -X quit
I would like to combine the scripts, that you must perform only one file to start/stop the servernetwork...
It would be perfect if there was skript, which allows to start/stop the servers seperately AND together.... But I have no idea if such a programm is even possible In another Forum they said i wouldn't be that hard to wirte something like that. They said I'd have to write a Start/Stop/Status script for the servers seperately and combine them in another script. Would be really nice if someone would help The gameservers are running a screen when they are online. It would be brilliant if I could check the Status of the servers. (The script has to check if there is a screen online with the name "XY")
I look forward to your answers
Yours sincerely
Spongebob
PS: Sorry for my bad english
I tried really hard with this one, but the status isn't working that fine and i can't connect the scripts:
#!/bin/bash
INSTANZ="Bungeecord"
BPDIR=/home/bungeecord
Pidfile=/home/Steuerung/bungee.pid
if [ -f $Pidfile ]
then
Pid=`cat $Pidfile`
fi
case "$1" in
'start')
if [ -f $Pidfile ] ; then
if test `ps -e | grep -c $Pid` = 1; then
echo "Not starting $INSTANZ - instance already running with PID: $Pid"
else
echo "Starting $INSTANZ"
cd $BPDIR
nohup ./start.sh &> /dev/null &
echo $! > $Pidfile
fi
else
echo "Starting $INSTANZ"
cd $BPDIR
nohup ./bsp.sh &> /dev/null &
echo $! > $Pidfile
fi
;;
'stop')
if [ -f $Pidfile ] ; then
echo "stopping $INSTANZ"
cd $BPDIR
nohup ./stop.sh &> /dev/null &
echo $! > $Pidfile
else
echo "Cannot stop $INSTANZ - no Pidfile found!"
fi
;;
'restart')
$0 stop
sleep 30
$0 start
;;
'status')
if [ -f $Pidfile ] ; then
if test `ps -e | grep -c $Pid` = 0; then
echo "$INSTANZ not running"
else
echo "$INSTANZ running with PID: [$Pid]"
fi
else
echo "$Pidfile does not exist! Cannot process $INSTANZ status!"
exit 1
fi
;;
*)
echo "usage: $0 { start | stop | restart | status }"
;;
esac
exit 0