Skip to content

Instantly share code, notes, and snippets.

@fmoledina
Forked from Stadicus/getpublicip.sh
Last active February 6, 2018 13:21
Show Gist options
  • Save fmoledina/8f1afc2c117ff857e58d44d172fd6fc7 to your computer and use it in GitHub Desktop.
Save fmoledina/8f1afc2c117ff857e58d44d172fd6fc7 to your computer and use it in GitHub Desktop.
Write public ip address into file every hour
#!/bin/bash
# getpubip.sh, use with systemd service and hourly timer
PUBIPADDR=$(curl v4.ifconfig.co)
echo "PUBIP_V4=$PUBIPADDR" > /etc/pubip/pubip
PUBIPADDR6=$(curl v6.ifconfig.co)
echo "PUBIP_V6=$PUBIPADDR6" | tee -a /etc/pubip/pubip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment