warn-if-broken-url/warn-if-broken-url.sh

23 lines
350 B
Bash
Raw Normal View History

2021-01-08 19:13:29 +00:00
#!/usr/bin/env bash
set -eu
URL="https://status.caracals.org"
2021-12-15 10:48:01 +00:00
# Move in repo folder
SCRIPT_PATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
2021-01-08 19:13:29 +00:00
pushd ${SCRIPT_PATH} > /dev/null
2021-12-15 10:48:01 +00:00
# Test URL
2021-01-08 19:13:29 +00:00
if ret=$(curl -s -f "${URL}"); then
echo "Marche"
else
echo "Marche pôs"
cat msg.txt | msmtp alban.bronisz@gmail.com
fi
2021-12-15 10:48:01 +00:00
# Move back
2021-01-08 19:13:29 +00:00
popd