scripts/monitoring/check_gemini.sh

24 lines
405 B
Bash
Executable File

#!/bin/sh
TLS_CLIENT="/usr/local/bin/gnutls-cli -p 1965"
if [ "$1" = "-h" ] || [ "$1" = "--help" ]
then
echo "usage: $0 <capsule name> (without gemini:// scheme)"
echo
return 0
fi
errorOutput=$(echo -n "gemini://$1/\r\n" | ${TLS_CLIENT} $1 2>&1 > /dev/null)
errorCode=$?
if [ $errorCode -gt 0 ]
then
echo "ERROR: ${errorOutput}"
return 2
else
echo "OK: capsule responding"
return 0
fi