scripts/monitoring/check_gemini.sh

23 lines
429 B
Bash
Executable file

#!/bin/sh
TLS_CLIENT="/usr/local/bin/gnutls-cli --port 1965 --no-ca-verification --crlf"
if [ "$1" = "-h" ] || [ "$1" = "--help" ]
then
echo "usage: $0 <capsule name> (without gemini:// scheme)"
echo
return 0
fi
errorOutput=$(echo "gemini://$1/" | ${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