Diapositivas y scripts de taller 1
This commit is contained in:
18
taller1/scripts/examples/status.sh
Executable file
18
taller1/scripts/examples/status.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# -- Constantes -- #
|
||||
SERVER='https://openbokeron.uma.es'
|
||||
TOKEN='TOKEN_AQUI'
|
||||
CHATID='CHATID_AQUI'
|
||||
|
||||
if curl -sSf $SERVER > /dev/null; then
|
||||
echo "Server OK"
|
||||
else
|
||||
# Server down
|
||||
curl -s -X POST \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d "{\"chat_id\": \"$CHATID\", \"text\": \"$SERVER\", \"disable_notification\": false}" \
|
||||
https://api.telegram.org/bot$TOKEN/sendMessage > /dev/null
|
||||
exit 1
|
||||
fi
|
Reference in New Issue
Block a user