4 ms·
Because I'm irritated by paying for dynamic DNS that actually works, I run the following script once an hour via cron(1): ip=`curl --silent ipinfo.io/ip`
by PaulDavisThe1st 4y ago
Because I'm irritated by paying for dynamic DNS that actually works, I run the following script once an hour via cron(1):
ip=`curl --silent ipinfo.io/ip`
ssh -i <CREDENTIALS> <MY-CLOUD-HOST> "echo $ip > lastlog"
Then anytime I need to know where home is:
ssh MY-CLOUD-HOST -C cat lastlog
[ EDIT: having posted this, i realized you could do the same thing just using whoami(1) on MY-CLOUD-HOST and avoid ipinfo.ip entirely ]
- dinosaurdynasty 4y agossh <MY-CLOUD-HOST> "echo \$SSH_CLIENT" | cut -f1 -d' ' works too
- somat 4y agoThe environment variable SSH_CONNECTION also gives this info. I have almost the same setup. mine looks sort of like this. echo "${SSH_CONNECTION}" | awk '{print $1}' | cat "/var/ip_log" - | uniq > "/var/ip_log.new" mv "/var/ip_log.new" "/var/ip_log"
- usrn 4y agoOn my machine I send this directly to nsupdate and have part of my personal domain delegated to that machine for dns stuff like this.
- toast0 4y agoI haven't tested it too hard, but hurricane electric's free dns includes a dynamic DNS option which seems to work as long as you don't cron it too frequently (every 5 minutes works, every minute was too frequent and got blocked)