Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


ewertb@gmail.com
2009-07-02T13:35:38Z
Hi

Is there a way one can let one job wait for another for successful completion?

I used...

//check if 1st job completed, and that it was successful
if (jobclass.Stats.ExitCode == 0)
{
//start 2nd job
}

...to see if the 1st job completed successfully, but it seems that the 2nd job is executed even before the 1st one completed.

The 1st job in my case is a process which creates a file, the 2nd is a process which moves that same file. The 1st job runs, it creates the file, then before it completes the 2nd one tries to move that file, but it doesn't give the first process enough time to complete creating that file.

I don't know how to create an event that will fire when the 1st job completes?
If one can that might help as I will only kick off the 2nd job when the 1st has completed running.

I have tried something like this also...

//run the 1st job
job.Run(jobclass);

//while the 1st job is running wait for a second
while (jobclass.Stats.Status == JobStatsClass.StatusT.Running)
{
System.Threading.Thread.Sleep(1000);
}

//run the 2nd job if the 1st job was successful and it is no longer running
if (jobclass.Stats.ExitCode == 0
&& jobclass.Stats.Status != JobStatsClass.StatusT.Running)
{
//start 2nd job
}

...but the issue still prevails.

Can anyone help please? 😕

Sponsor
Forum information
Support
2009-07-02T18:25:45Z
You should use the VisualCron Trigger which starts a Job when another Job is completed. To be sure it is success you can use a Condition to check the success of the other Job.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top