concourse-apprise-notifier/check

21 lines
341 B
Text
Raw Normal View History

2023-05-26 18:04:49 +00:00
#!/bin/sh
2023-05-26 19:01:05 +00:00
2023-05-26 21:20:20 +00:00
set -e
2023-05-26 19:01:05 +00:00
2023-05-26 21:20:20 +00:00
exec 3>&1 # make stdout available as fd 3 for the result
exec 1>&2 # redirect all output to stderr for logging
PAYLOAD=$(mktemp /tmp/resource-check.XXXXXX)
cat > "$PAYLOAD" <&0
TS=$(jq '.version.timestamp // empty' < "$PAYLOAD")
if [ -z "$TS" ]; then
echo '[]' >&3
else
jq -n "[
{ timestamp: $TS }
]" >&3
fi