I’m too cheap to get a fixed IP address, and at some point recently, my router’s external IP address (i.e. the one assigned by my cable provider) changed. So I’d like to write a cron job that runs every hour and dumps my external IP address on a computer somewhere else, so I’ll always know how to connect to it.
I’m blanking on a good way to figure this out from within a cron job. If I just ssh ‘lastlog’ or ‘who’ to the remote computer, I only get my last actual login. If I try to mimic sshing in for real in a naive way (e.g. ssh $REMOTE_HOST << EOF) then I get complaints because stdin isn't a terminal. I'm pretty sure I could go down that path a little longer and fix it, but I get the feeling that I must be missing some much simpler solution to this problem: the information I'm trying to get isn't exactly a big secret, after all. And no, I don't want to log into the router and ask it, if for no other reason than that I've set up the router's administrative interface to only be accessible via a wired connection, which isn't possible from the computer where I want to run the cron job.
There are no revisions for this post.