I have a shell script which runs from 7AM to 3AM every day. The script performs certain monitoring functions and if it has a problem it may need to email someone about it. The problem is that the notification process was never modified to handle running past midnight (from 23:59:59 till 3AM). The current process uses a data file that specifies the times email notification should be sent (first = day of week, 2nd = start time, 3rd = stop time):
0 070000 235959
1 070000 235959
etc.
Past logic was to take the current date and add the start time together to get "starttime" and add end time to the current date to get "endtime". If "now" is between "starttime" and "endtime" page, else don't.
I need to change this to be something like
0 070000 020000
1 070000 030000
etc.
I am having trouble dealing with after midnight. So, if it is 08/30/06 00:00:01 I don't want the "starttime" to be "08/30/06 07:00" and the "endtime" to be "08/31/06 03:00". Also, I need to the logic to be smart enough to deal with accurately determining what the next or previous day is based on the result of "date".
I have looked briefly at "datecalc" but I don't see that it can do what I need.
Any help?
Thanks.