~armagetronad-ap/armagetronad/BattleMania

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh

server="battle_mania"
loc="/home/vertrex/normal/servers/"${server}"/"
command=${loc}"command.txt"
console=${loc}"console.txt"

case $1 in
    start)
        if ! screen -list | grep -q ${server}; then
            rm -rf ${command}
            touch ${command}

            rm -rf ${console}
    
            echo "Starting "${server}" immediately!"
            screen -dmS ${server} ./server.sh ${server}
        else
            echo ${server}" is already running..."
        fi
    ;;
    stop)
        if ! screen -list | grep -q ${server}; then
            echo ${server}" server is already stopped..."
        else
            echo "Stopping "${server}" immediately!"
            echo "EXIT" >> ${command}
            sleep 1
            screen -S ${server} -X quit
        fi
    ;;
esac