Need opinions about scripting blackouts

Hi All.
I am stuck and need some fresh ideas...

I am writing a script that checks to see if an Oracle db is available. The script reads an ini file to determine if there is a blackout period for certain db's... ie: we don't care if it's up or down 1700 - 700 the next morning.

The ini file looks like:

<db_name>:<priority>:<blackout_start>:<blackout_end>

so

dbs1:H:17:07 (Where 17 is 5 PM and 07 is 7 AM)

Now I have code that looks like:

 
BLACKOUT_START=`grep -i "$ORACLE_SID" $INIFILE | cut -d":" -f3`
BLACKOUT_END=`grep -i "$ORACLE_SID" $INIFILE | cut -d":" -f4`
CURRENT_HOUR=`date +%H`
if [[ $CURRENT_HOUR -ge $BLACKOUT_START || $CURRENT_HOUR -lt $BLACKOUT_END ]]; then
   if [[ $CURRENT_HOUR -ge $BLACKOUT_START && $CURRENT_HOUR -lt $BLACKOUT_END ]]; then

I can't get my head around the logic to check for the conditions when the blackout end is less then the current hour and greater then the current hour and so on...

If Anyone has any suggestions or a cool blackout processing script that I could look at I would greatly appreciate it.

Thanks.

Something like that :

BLACKOUT_START=`grep -i "$ORACLE_SID" $INIFILE | cut -d":" -f3`
BLACKOUT_END=`grep -i "$ORACLE_SID" $INIFILE | cut -d":" -f4`
CURRENT_HOUR=`date +%H`

CHECK_BASE=YES
if (( BLACKOUT_START > BLACKOUT_END ))
then
   (( CURRENT_HOUR >= BLACKOUT_START ||  CURRENT_HOUR <= BLACKOUT_END )) && CHECK_BASE=
else
   (( CURRENT_HOUR >= BLACKOUT_START &&  CURRENT_HOUR <= BLACKOUT_END )) && CHECK_BASE=
fi

if [ -n "$CHECK_BASE" ]
then
   : Check database
fi

Jean-Pierre.

If you need to make a lot of decisions like that, it can be easier to convert the time to absolute minutes: hours times 60 plus minutes. This lets you make direct greater than, less than tests.

Thanks for the input guys.
I have it working the way I need it to now.