Skip to content

Instantly share code, notes, and snippets.

@saderi
Last active January 14, 2019 12:22
Show Gist options
  • Save saderi/92f80d4eead5c2f9a4a019698b101d15 to your computer and use it in GitHub Desktop.
Save saderi/92f80d4eead5c2f9a4a019698b101d15 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Check domain and send email and sms when domain is available for register.
# Requairment:
# whois linux coomand
# mutt linux coomand
# clickatell.com acount
#
# You must added to your system cron :D,
# I suggest lets cron run this script every 5th minute
DOMAIN_NAME='example.com'
MESSAGE="$DOMAIN_NAME is available"
YOUR_EMAIL='youremail@balabal.com'
API_KEY='xxxxxxx-xxxxxxxxxxxxxxx'
YOUR_PHONE_NUMBER='' # Enter complete number without '+' ro '00'
SMS_MESSAGE="$DOMAIN_NAME+is+available"
whois $DOMAIN_NAME | egrep -q '^No match|^NOT FOUND|^Not fo|AVAILABLE|^No Data Fou|has not been regi|No entri'
if [ $? -eq 0 ]; then
mutt -s $MESSAGE $YOUR_EMAIL < /dev/null
curl "https://platform.clickatell.com/messages/http/send?apiKey=$API_KEY&to=$YOUR_PHONE_NUMBER&content=$SMS_MESSAGE"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment