Last active
April 28, 2016 15:13
-
-
Save cemk/9e6cebe6b9fe47d6c1e9d76e358ab84f to your computer and use it in GitHub Desktop.
This bash script gets your devices local IPv4 and sets it to your zzzz.io domains. (My usecase: I carry around a Raspberry Pi for web development, and can set multiple domains in one line so I can continue testing no matter what network or device I'm on.)
This file contains 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 | |
# Get your token from zzzz.io | |
ZZZZ_TOKEN="YOUR-TOKEN-HERE" | |
# Your domains as a list. | |
domains=("DOMAIN1" "DOMAIN2") | |
# Let the code do its thing. | |
LOCALIP="$(ifconfig wlan0 | grep "inet addr" | cut -d ':' -f 2 | cut -d ' ' -f 1)" | |
echo "Local IP: $LOCALIP" | |
for DOMAIN in "${domains[@]}" | |
do | |
curl "https://zzzz.io/api/v1/update/$DOMAIN/?token=$ZZZZ_TOKEN&ip=$LOCALIP" | |
echo " $DOMAIN" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment