Forum Discussion
MW1
Apr 30, 2013Cirrus
Realise I am starting to fall out of the irule arena, however to prevent starting multiple threads - looking in to loading a data group it appears I need to issue a b load to reload the config. Can anyone advise if existing connections are disrupted/lost during a config load?
To complete the picture I am running an external monitor script to poll and update the data group from a remote web site (guess could as easily be done by cron - however thanks to the gent who suggested)
!/bin/bash
F5 monitor script to pull IP list for data group from remote web page
define tmp file with path for download
tmpfile="/var/tmp/ip-tmp"
define final IPlist data group file with path used by F5
IPlist="/var/class/IPlist"
define URL to retrive IP's from e.g http://site/list.html
URL="http://192.168.52.243/IPlist.html"
PIDFILE="/var/run/`basename ${0}`.pid"
kill of the last instance of this monitor if hung and log current pid
if [ -f $PIDFILE ]
then
kill -9 `cat $PIDFILE` > /dev/null 2>&1
fi
echo "$$" > $PIDFILE
Call curl to download IP list and pull IP's using perl with correct formatting and write to tmp file
curl -s $URL | perl -lne 'while (/(\d+\.){3}\d+/g){print "host $&,"}' > $tmpfile
Check tmp is not empty
if [ -s "$tmpfile" ]
then
check if the files differ
diff $tmpfile $IPlist
if [ $? -ne 0 ]
then
copy the tmp file over the original file
cp -fr $tmpfile $IPlist
reload config to pick up new data group
b load
fi
fi
rm -f $tmpfile
rm -f $PIDFILE
exit