I will try and implement your code snippet and see how it goes.
I think I may need to do an equal's as well as a startswith()
because the server may start the application a minute after for
beforethe scriptsThatShouldRun list says. Do you see a different
way of writing my script without each loop?
Thanks for all your help.
: : I have a question on stepping through a loop or a tree
: : of requirements. Currently I have 3 lists built that I
: : need to get info from:
: : scriptsThatShouldRun 
: : # list built from a DB
: : scriptsThatDidRun 
: : # every minute of that particular day
: : minutesList 
: : This next part is where I need some help because it gets
: : a little tricky.
: : I have to check each element of the "scriptsThatShouldRun"
: : list against the "minutesList" list and break down each
: : bit of info to compare in that list: day of week, month,
: : day of month, hour and minute.
: : If the minutesList shows: Mon Aug 31 00:00, then I need to
: : see if the scriptsThatShouldRun matches this exactly so I
: : check: the day of week, month, date, hour and minute
: : If it does MATCH, then I will then compare against the list
: : scriptsThatDidRun and look if it has the same value, if it
: : does append to a success list or if its not in there append
: : to a failure list.
: : If it does NOT MATCH, then I ignore it and move onto the next
: : element of the list because that item "scriptsThatShouldRun"
: : is NOT eligible to run @ that time of day, so nothing should
: : happen.
: : In basic words:
: : The whole point is to check the scriptsThatShouldRun list
: : against the scriptsThatDidRun all the while looping through
: : the minutesList list (every minute of the day). The basic
: : meaning of this is to go minute by minute and check if a
: : a script is eligible to run, if it is, compare and see if
: : it really did run and report on that.
: : Basically, if the time in minutesList matches the time in
: : scriptsThatShouldRun, I need to check the scriptsThatDidRun
: : and append to success or failure.
: : I hope this all makes sense? Any code examples or pointers
: : you may have would be very helpful.
: Ok, but I still think you're doing way too much work with the list of minutes.
: for minute in minutesList:
: for script in scriptsThatShouldRun:
: if script.startswith(minute):
: if script in scriptsThatDidRun:
: This is the most simplified version I could think of. The startswith() method of strings looks to see if the string starts with the exact string passed to it. This will of course only work if the date/time format is exactly the same for both lists.
: $ select * from users where clue > 0
: no rows returned