scripts/monitoring/check_gemini.sh

24 lines
431 B
Bash
Raw Normal View History

2021-02-20 17:45:48 +01:00
#!/bin/sh
TLS_CLIENT="/usr/local/bin/gnutls-cli --port 1965 --no-ca-verification --crlf"
2021-02-20 17:45:48 +01:00
2021-02-20 21:10:00 +01:00
if [ "$1" = "-h" ] || [ "$1" = "--help" ]
2021-02-20 17:45:48 +01:00
then
echo "usage: $0 <capsule name> (without gemini:// scheme)"
echo
return 0
fi
2023-10-19 17:53:44 +02:00
errorOutput=$(echo "gemini://$1/" | ${TLS_CLIENT} "$1" 2>&1 > /dev/null)
2021-02-20 17:45:48 +01:00
errorCode=$?
2021-02-20 21:10:00 +01:00
2021-02-20 17:45:48 +01:00
if [ $errorCode -gt 0 ]
then
echo "ERROR: ${errorOutput}"
return 2
else
echo "OK: capsule responding"
return 0
fi
2021-02-20 21:10:00 +01:00