#!/usr/bin/env bash # # Send a short plain-English alert to the SkateSpots admins as a NIP-17 DM. # Usage: scripts/send-ops-alert.sh "message" set -euo pipefail REPO="/home/sovereignsk8/SkateSpots" cd "$REPO" if [ -d "$HOME/.nvm/versions/node" ]; then NODE_BIN="$(ls -d "$HOME"/.nvm/versions/node/*/bin 2>/dev/null | sort -V | tail -1)" [ -n "$NODE_BIN" ] && export PATH="$NODE_BIN:$PATH" fi export PATH="$HOME/go/bin:$PATH" MSG="${*:-SkateSpots needs attention.}" { echo "SkateSpots alert" echo echo "$MSG" echo echo "$(LC_ALL=C date '+%A %-d %B %Y, %H:%M')" echo echo "This message was sent automatically to the SkateSpots admins." } | timeout 90 "$REPO/node_modules/.bin/tsx" "$REPO/scripts/send-ops-report.ts"