currently i am facing an issue.
I have a script which should be in a loop until midnight to do not process further before 00:00.
If it is for example 00:05:23 am the script should finish and the process should continue.
The script is executed everyday at different times. Could be 07:00 pm, could be 11:34 pm could also be on the next day around 00:32 am.
The only think which is sure that the script is not activated again before 16:00 (04:00 pm) in the afternoon
: SET &Time# = sys_time()
: IF &Time# < "160000": p "EXECUTE OBJECT XXXX": ELSE
: WHILE &Time# >= "160000": p "Too early to EXECUTE OBJECT XXXX": WAIT 1800
: ENDWHILE: ENDIF
What i want to achieve is to be in the loop until &TIME# is < "160000" (04:00 pm
As the script is always activated after 160000 (04:00 pm) i thought i could be an idea to check sys_time < "160000" and that is the case after midnight. (f.e. 000523 (00:05:23)
The script is not ending the loop. I think it is because of the different days.
If i modify the script with times on the same day its working fine.
Hope someone has an advice for me.
Thanks in advance.
I would not script it, i would make 2 different scripts in a plan and set a 'earliest start' on the 2nd script. But maybe that doesn't fit your needs.
For me it seems you try to do something using a ???Script-Object??? what you have as funcitonality in a workflow out of the box. Place an object to execute an use earliest start time, what is calculated from the execution of the workflow. The workflow you can schedule using a schedule or period object.
Is there any other dependencies we might miss as it's not part of your description you have to take care?
are you trying to use this script to execute other jobs as well? or just to control the execution of the job in the script?
If it is only for that job in the script, I think there are better ways to do it than using a script object/script
Not sure which version you are using but If it is greater than V10, I am sure you can use
1. pre-conditions and execute the object only after the specified time
2. Use earliest start date/time option as well
thanks for your replies.
I tried already with precondition and earliest start time.
Its just working if it is on the same day.
so if JOBS "A" is started at 22:00 and finishes at 23:00 and my Pre-Condition earliest start time for JOBS "B" is 01:00 (different day) it is not working.
If JOBS "A" is start at 00:01 and finishes at 00:40 and Pre-Condition earliest start time for JOBS "B" is set to 01:00 (same day) its working fine.
So the problem is the day switch. And my JOBS "A" can run on each time - it depends on the processes before.
Maybe this is a bug and you should open a ticket. Let's if it's possible to verify.
we use AWA Automic Web Interface 12.1.1
Below the prints.
JOBS.WIN.PING started at 22:30 and ended on 22:31.
JOBS.WIN.PING2 didn't wait until 01:00 and directly started.
If JOBS.WIN.PING is started at 00:01 and ended at 00:02 JOBS.WING.PING2 is waiting until 01:00.
So for me the issue is if the JOBS.WIN.PING is running on DAY 1 i cant use the earliest start time in pre condition of JOBS.WIN.PING2 which should be exectued on DAY2And therefore i can't use the option of "Real date + X days in preconditon tab.Its just usable if you are 100 % sure that both JOBS are running on the same day. its not the case on our side. JOBS.WIN.PING can be executed on DAY1 and run until DAY2.It can be executed on DAY1 and finish on DAY1, it can be executed on DAY2 before or after 01:00, it can be executed on DAY2 and finish before 01:00 .....
Thanks for your reply.
you have to put real date +1 days into the definition and make sure that the workflow starts before midnight. Then it will work as expected.
To understand, the logical date (activation date) is calculated when the workflow is generated. That's why +1 days = next day is the value to choose.
If it doesn't activate a 1 AM next day, please open a support ticket as in this case it looks like a bug in the AWA version you are using.
Hope this help,
i will try it this evening and come back to you tomorrow morning.
But i really try to get a solution without beeing dependent on the execution time/date.
Thanks for you help
sorry reading you intro again, I see.
But I have to ask again as I'm not 100% sure I got it:
You have two or maybe more jobs have to run every day in a sequence with a dependency. One of this jobs should not start before 16:00 and after previous defined job(s) has finished OK - correct? You want to run this once for each day, but it's OK if the job is executed after midnight in case of a delayed start?
If you don't active the whole workflow after midnight, the solution is to put earliest start same day 16:00 on "job 2" and take care that the workflow is started using a schedule or recurred planing with a start time before midnight. For maintenance windows you can use a specific queue this jobs are using, to delay the start of the jobs it self by stopping and starting the queue.
We use pre-conditions. I know they've been discussed but they work great for us: