[Firehol-support] daily check for changed reserved ips

Rick Marshall rjm at zenucom.com
Wed Jun 13 06:59:27 BST 2007


For those that are interested here is a small script I put into 
/usr/share/doc/firehol-1.256 called cron.daily and then linked to 
/etc/cron.daily

ln -s /usr/share/doc/firehol-1.256/cron.daily /etc/cron.daily/firehol

It checks daily for changed RESERVED_IPS and if necessary restarts firehol

Regards
Rick

#!/bin/bash

# CRON.DAILY - firehol daily cron task to fix RESERVED_IPS
#
# Contributed by: Rick Marshall - Zenucom Pty Ltd - http://www.zenucom.com
#

# 0. Is firehol running?

RUNLEVEL=`who -r | awk '{print $2}'`
if [ `chkconfig --list firehol | sed "s/.*$RUNLEVEL:\(..\).*/\1/"` == 
"on" ] ; then
        # 1. Get new file

        echo yes | /usr/share/doc/firehol-1.256/get-iana.sh 2>/dev/null

        # 2. Did we get a file?

        find /etc/firehol -cmin -5 | grep 'RESERVED_IPS$' >/dev/null

        # 3. Restart if we did

        [ $? == 0 ] && { echo "firehol: RESERVED_IPS changed - 
restarting" ; service firehol restart ; }
        fi





More information about the Firehol-support mailing list