#!/bin/bash {# nocheck: shell-template grandfathered, values only: bot token, chat id and the curl filter's timeout #} set -u # Make the instance text human readable again (reverse systemd escaping) friendly="$(systemd-escape --unescape "$1")" if command -v hostname &>/dev/null; then host=$(hostname) else host="$HOSTNAME" fi {{ 30 | curl }} -X POST \ "https://api.telegram.org/bot{{ TELEGRAM_BOT_TOKEN }}/sendMessage" \ -d chat_id="{{ TELEGRAM_CHAT_ID }}" \ --data-urlencode text="service ${friendly//\//-} on ${host} failed"