#!/bin/sh set -e if [ -z "$TOR_HOST" ]; then echo 'missing $TOR_HOST' exit 1 elif [ -z "$ONION_SERVICE_HOST" ]; then echo 'missing $ONION_SERVICE_HOST' exit 1 elif [ -z "$ONION_SERVICE_PORT" ]; then echo 'missing $ONION_SERVICE_PORT' exit 1 elif [ -z "$MAIL_TO" ]; then echo 'missing $MAIL_TO' exit 1 fi sender_address="onion-service-status@$(hostname).local" ping_onion_service() {( if [ ! -z "$VERBOSE" ]; then set -x fi nc -z -w "$TIMEOUT_SECONDS" -x "$TOR_HOST:$TOR_PORT" "$ONION_SERVICE_HOST" "$ONION_SERVICE_PORT" )} send_report() {( if [ ! -z "$VERBOSE" ]; then set -x fi sendmail -t <