Forum Discussion
MW1
Cirrus
Apr 29, 2013Can someone advise if this format of external class file (old v9.3.1) for addresses is in the correct formatt
Hi,
I have an irule that I have mashed together that checks the clients IP against a list in a file held locally on the F5 which works when I use an internal data group but is failing when I u...
MW1
Cirrus
Apr 30, 2013Realise 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
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects