lila/bin/diagnostic
Saskia Gennrich 792d8b4d44
Update bin/diagnostic
In `#!/bin/sh` the echo command does not accept any options. It will just print "-e" on the screen. [0]
With bash there would be no problem and is probably also installed by all contributors.

sbt is weird. sbt doesn't use the commonly used version option, but an sbt command. 
Maybe checking that sbt is installed with `which sbt` would even be sufficient, as sbt downloads the appropriate version for the project anyway.

[0] https://www.unix.com/man-page/posix/1posix/echo/
2020-12-02 20:36:16 +01:00

54 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
MONGO_PORT=27017
REDIS_PORT=6379
LILA_PORT=9663
LILA_WS_PORT=9664
LILA_FISHNET_PORT=9665
SEPARATOR="\n\n=========================================\n\n"
echo -e "Java version: $(java --version)\n"
echo -e "SBT version: $(sbt sbtVersion)\n"
echo -e "Node version: $(node --version)\n"
echo -e "Yarn version: $(yarn --version)\n"
echo -e $SEPARATOR
mongo 127.0.0.1:$MONGO_PORT/lichess --eval "print('ok')"
echo -e $SEPARATOR
redis-cli -h 127.0.0.1 -p $REDIS_PORT info
echo -e $SEPARATOR
LILA_STATUS=$(curl -sL -w "%{http_code}" -I "127.0.0.1:$LILA_PORT" -o /dev/null)
echo "Reaching lila..."
echo "lila: $LILA_STATUS"
if [ "$LILA_STATUS" -ne "200" ]; then
exit 1;
fi
echo -e $SEPARATOR
LILA_WS_STATUS=$(curl -sL -w "%{http_code}" -I "127.0.0.1:$LILA_WS_PORT" -o /dev/null)
echo "Reaching lila-ws..."
echo "lila-ws: $LILA_WS_STATUS"
if [ "$LILA_WS_STATUS" -ne "403" ]; then
echo "NOT STARTED"
fi
echo -e $SEPARATOR
LILA_FISHNET_STATUS=$(curl -sL -w "%{http_code}" -I "127.0.0.1:$LILA_FISHNET_PORT" -o /dev/null)
echo "Reaching lila-fishnet..."
echo "lila-fishnet: $LILA_FISHNET_STATUS"
if [ "$LILA_FISHNET_STATUS" -ne "404" ]; then
echo "NOT STARTED"
fi
echo -e $SEPARATOR
echo "You're all set"