Skip to content

Instantly share code, notes, and snippets.

@mariodian
Created December 27, 2016 04:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mariodian/c43055509853bffb492b7b228a143764 to your computer and use it in GitHub Desktop.
Save mariodian/c43055509853bffb492b7b228a143764 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Create log file
LOG="/tmp/ip-check.log"
touch $LOG
IP="$(dig +short myip.opendns.com @resolver1.opendns.com)"
LAST_IP="$(cat $LOG)"
if [ "$IP" != "$LAST_IP" ]; then
# Save the new IP
echo $IP > $LOG
# Restart OB
sudo service openbazaar restart
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment