#!/bin/bash # # Suitable for (at least) RedHat Enterprise Linux 6. # # Put this file, with executable permission in # /etc/NetworkManager/dispatcher.d # with a name such as # 90-say-hello # in order to have it run on each change of an interface. # # interface name: e.g. eth0, wlan0 IF=$1 # 2nd arg: status: can be: up, down, pre-up, post-down CH=$2 # leave a log message on a webserver, so that we can find the time and # apparent ip address for every time that the interface changes wget http://gnu.ets.kth.se/hello_from_$(hostname)_${IF}_${CH}.ping -a /var/log/ifup_last.log -O /dev/null