Skip to content

Instantly share code, notes, and snippets.

View fabiofdsantos's full-sized avatar

Fábio Santos fabiofdsantos

View GitHub Profile
@fabiofdsantos
fabiofdsantos / reload-iptables-if.sh
Last active April 25, 2016 12:54 — forked from Khoulaiz/check_dyn_hostname
Reload iptables if... (e.g. ip was changed)
#!/bin/bash
# Reload iptables if... (e.g. ip was changed)
# Dependencies: dig (apt-get install dnsutils in debian/ubuntu)
# Note: Run "touch ~/current_ip" and add a new cron job with cmd "crontab -e" to run this script periodically.
HOSTNAME=<hostname-to-check.dyndns.org>
LOGFILE=~/current_ip
Current_IP=$(dig +short $HOSTNAME)