Scheduled Jobs : any way to schedule at specific times during the day?

Vote:
 

Hi,

I have a job which needs to be synchronised with a data extract which happens at specific times of the day, but I have been unable to find any resources for how this could be achieved.

Ideally, I would want to be able to schedule several hours throughout the day.

 

Any help would be much appreciated.

Many thanks,

Paul

#51959
Jun 30, 2011 10:40
Vote:
 

There's no built in functionality for this. What you can do is to run the job every minute and check in the job if it is time to run the job. Not an ultimate solution, but it solves the problem.

/Erik

#51966
Jun 30, 2011 11:12
Vote:
 

You can only schedule a job on a fixed recurring interval, like for example every 2nd minute or every 3rd day or every 7th year

If you want the job to run at 09:00 12:00 and 21:00 every day, you could do it by scheduling the job as three individual "jobs", each with an interval of
1 day and exavtly set the nextExecute to the desired times.

This requires some coding however, as this functionality is not exposed through the Admin user interface.

Have a look at the ScheduledJob class (in EPiServer.DataAbstraction), it would let you create/save/load jobs programmatically.

/johan

#51969
Edited, Jun 30, 2011 14:04
Vote:
 

Erik, 

Although I think this is the most effective answer, we have gone down the route of running the job once an hour, which doesn't involve any code changes, and should hide within the timeslot of the other extract.

Many thanks for taking the time to answer to you both.

#52014
Jul 01, 2011 17:39
Vote:
 

I had similar issue, but had to run ScheduledJob with some interval between job completion. So I created method SetNextRun in ScheduledJob class:

private void SetNextRun()
        {
            var job = ScheduledJob.Load(ScheduledJobId);
            if (job.IsEnabled)
            {
                job.NextExecution = DateTime.Now.AddSeconds(10);
                job.Save();
            }
        }

    

But it is possible also to use it for scheduling job to particular time.

I also had method for job to deactivate itself if it's done:

        private void Deactivate()
        {
            var job = ScheduledJob.Load(ScheduledJobId);
            job.IsEnabled = false;
            job.Save();
        }

    

#61669
Edited, Sep 27, 2012 7:43
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.