#!/bin/bash # Workaround to reload Jitsi VideoBridge configuration after # unnoticed public IP address change when jitsi is self hosted # and connected to the internet via private DSL connection. # This happens approximately every 24 hours and is often forced # by the ISP. # # Author: C. von Thuelen wan_ip_logfile=/tmp/last_wan_ip.log wan_ip_changelog=/tmp/wan_ip_change.log # read last public IP from logfile: if [ -e $wan_ip_logfile ]; then source $wan_ip_logfile fi # get actual public IP: new_wan_ip=`curl -s ifconfig.me/ip` # at first start "$lastip" is empty if [ -z $last_wan_ip ]; then echo "last_wan_ip=\"$new_wan_ip\"" > $wan_ip_logfile fi # compare last and actual public IPs: if [ "$new_wan_ip" != "$last_wan_ip" ]; then # if not equal: # save new public IP to logfile echo "last_wan_ip=\"$new_wan_ip\"" > $wan_ip_logfile daytime=`date +%Y%m%d_-_%H:%M` echo "Last IP update: $daytime, IP changes from $last_wan_ip to $new_wan_ip" >> $wan_ip_changelog # and reload jitsi videobridge /etc/init.d/jitsi-videobridge2 restart else # do nothing ;-) : fi