mercredi 23 décembre 2020

Im trying to save the output from if else statement into an variable, but its not working

So the script is just saying, that the server is offline, but when i look with "screen -ls", the server is online.

if screen -list | grep -q "Proxy"; then
    proxy=$0
fi

if screen -list | grep -q "Lobby"; then
    lobby=$1
fi

if screen -list | grep -q "CB1"; then
    cb1=$2
fi

if [ $0 = 0 ]; then
    echo "Proxy online"
   else
    echo "Proxy offline"
fi

if [ var=$1 = 1 ]; then
    echo "Lobby online"
   else
    echo "Lobby offline"
fi

Aucun commentaire:

Enregistrer un commentaire