Skip to content

Instantly share code, notes, and snippets.

@samber
Created March 23, 2017 07:00
Show Gist options
  • Select an option

  • Save samber/7c31c5b6c3e44cd70a580b845c038f88 to your computer and use it in GitHub Desktop.

Select an option

Save samber/7c31c5b6c3e44cd70a580b845c038f88 to your computer and use it in GitHub Desktop.
Alert myself on slack when an Online server is available
#!/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