Created
March 23, 2017 07:00
-
-
Save samber/7c31c5b6c3e44cd70a580b845c038f88 to your computer and use it in GitHub Desktop.
Alert myself on slack when an Online server is available
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| SERVER_MODEL=dedibox-xc | |
| SLACK_WEBHOOK_URI="https://hooks.slack.com/services/VERY/SECRET/TOKEN" | |
| while [ 1 ]; do | |
| is_available=$(curl https://www.online.net/en/dedicated-server/${SERVER_MODEL} | grep -c 'greentxt') | |
| if [ ${is_available} != 0 ]; then | |
| curl -X POST -d 'payload={"channel": "#your-channel", "username": "bot", "text": "Online server available", "icon_emoji": ":rocket:"}' ${SLACK_WEBHOOK_URI} | |
| fi | |
| sleep 30 | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment