Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # simple script to check to see if our NOAA streaming server is working correctly.
- FAILTITLE="NOAA STREAMING FAILURE"
- FAILMESSAGE="NOAA Streaming has failed!"
- OKTITLE="NOAA STREAMING OK"
- OKMESSAGE="NOAA streaming has been restarted!"
- ACCESSTOKEN=put_your_access_token_here
- CHANNEL="internal-noaa"
- STREAMING_STATUS=`ps aux | grep arecord | wc -l`
- EXPECTED_STATUS=2
- if [ "$STREAMING_STATUS" = "$EXPECTED_STATUS" ]; then
- echo "NOAA Streaming - Normal"
- if [ -e /root/noaa_alert_sent ]; then
- /usr/bin/curl --header "Access-Token: ${ACCESSTOKEN}" --header 'Content-Type: application/json' --data-binary "{\"body\":\"${OKMESSAGE}\",\"title\":\"${OKTITLE}\",\"type\":\"note\",\"channel_tag\":\"${CHANNEL}\"}" --request POST https://api.pushbullet.com/v2/pushes >> /dev/null
- rm /root/noaa_alert_sent
- exit
- else
- exit
- fi
- else
- echo "Houston, we have a problem"
- if [ -e /root/noaa_alert_sent ]; then
- exit
- else
- /usr/bin/curl --header "Access-Token: ${ACCESSTOKEN}" --header 'Content-Type: application/json' --data-binary "{\"body\":\"${FAILMESSAGE}\",\"title\":\"${FAILTITLE}\",\"type\":\"note\",\"channel_tag\":\"${CHANNEL}\"}" --request POST https://api.pushbullet.com/v2/pushes >> /dev/null
- touch /root/noaa_alert_sent
- /root/noaa.sh >/dev/null 2>&1
- echo "NOAA Streaming Restored - Please check!"
- exit
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement