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.