Last active
December 26, 2015 22:19
-
-
Save scottlee/7222328 to your computer and use it in GitHub Desktop.
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 | |
# Get IP address from output file in Dropbox. | |
ip=`cat ~/Dropbox/HomeNetworkIP.txt` | |
# Establish SSH session | |
ssh $ip | |
# To connect: | |
# ./Dropbox/scripts/connect_to_home.sh |
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 | |
# Specify output file for IP address here. | |
ip_file=HomeNetworkIP.txt | |
# --------------------------- # | |
# Let's get down to business | |
# --------------------------- # | |
# Get current IP address | |
current_ip=$(curl -s http://icanhazip.com) | |
# If the IP file exist, grab the old IP address | |
if [ -f "$ip_file" ] | |
then | |
old_ip=$(<$ip_file) | |
fi | |
# If current IP address is NOT the same as the old update the IP file. | |
if [ $current_ip != $old_ip ] | |
then | |
echo $current_ip > $ip_file | |
else | |
exit | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment