checking if hour is between two hours

F

Flyzone

Hi all, i'm again working on my script of parsing logfiles :)
I putted a new function to disable the rule of error between a certain
hours, cause i want to use it as a monitoring script that run every 5
minutes and to disable error in hours of maintenance.
But i have some "problems" to check it.
In the rule-file i have HHMM(start) and HHMM(stop) ----- 0 0 to
disable hours check (i can't check the timestamp in logfile cause not
all the logfiles that i need to check have a timestamp in it).
In the script i wrote:

Actualtime=datetime.datetime.today().strftime("%H%M")
if (start>end):
if (Actualtime>start):
end=int(Hcheck)+1
else:
if (int(Actualtime)<int(end)):
start=Actualtime
if ((int(Actualtime)<int(start)) or (int(Actualtime)>int(end)) or
((start=="0") and (end=="0")) ):
rule=error
...blablabla....
else:
rule=skip
....blablabla....
Why i don't use the complete date with YYMMDDHHMM?
Think about a rule that need to be disabled from hours 20:00 to
04:00.
If i use also yymmdd, in the rule file i need to write a 2000 and
0400+1, the +1 to tell the script that the end
is in the day after, to add a day. But it will work just till the
0000, hour in witch the day will change.

The script work, but is not so "clean"....i just would like some
advice to make it more clean, if possible.

Like always, thanks in advance for the helps :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top