#!/bin/bash # announce-ip su 11.12.2011 16.55.17 +0200 # # Changes since pe 7.10.2011 18.11.26 +0300 # - eat multiple eth interfaces (last one picked) # # Changes since pe 7.10.2011 17.51.02 +0300 # - config file name: dash to underscore # # pe 7.10.2011 17.51.02 +0300: First release source "/usr/local/etc/announce_ip" >/dev/null 2>&1 || exit 1 test "x$URL" = "x" && exit 1 for iface in `ifconfig | grep eth | cut -d\ -f 1` do IP=`ifconfig $iface | grep inet | awk '{printf $2}' | cut -d: -f2 | cut -da -f1` test "x$IP" = "x" || break done test "x$IP" = "x" && exit 1 curl -4 -s "${URL}${IP}"