I just want to run a cronjob every 2 and half hour time gaps, I tried 30 */2 * * * but this not working, any idea how to do this?
Posting this as a community wiki, feel free to edit and expand.
As it was pointed out in comments, it's not possible to setup cronjob with simple expression to run every 2.5 hours.
Workaround is to have two separate jobs which run every 5 hours.
Or as you mentioned in comments that you can't have two jobs, then as #larsks said you will need to implement some logic in your script:
The easiest solution would be to run your script every 30 minutes,
then have the script check the elapsed time since the last run and
only run when the elapsed time >= 2.5 hours.
Please find some already asked and answered questions about this topic:
How to execute a cron expression for every 2.5 hours?
Schedule a cronjob to run every 2 1/2hours
Running a cron job every 2:30 on every day?
Related
Part one:
How can I run a production line only for 15 hours per day?
My logic
Part Two:
How to implement a machine malfunctioning 3 times in 10 days?
I achieved the malfunctioning of a machine using this logic.
if(countAssembler==10){
self.suspend(agent);
create_MyDynamicEvent(2, HOUR,agent);
}
But malfunctioning is occurring on item count (i.e. countAssembler==10) right now. I want it to occur after 3 days.
part 1
To make the services work for a period of time every day, you need resources to be used in those services, and the resources to be subjected to a schedule. The schedule is an object that you can find in the process modeling library and there's a ton of documentation and examples on how to use them. Review the help documentation.
part 2
There's a block in the process modeling library called downtime. Again there's a ton of documentation and examples on how to use this for any model. Then you don't need any java code
I'm looking for an option in autosys to send an alert if the dependant jobs don't start within 10 min of the avg run time, for example, the last 30 days. The dependant jobs, do not have a fixed starting condition. They might have run at varying times in the last 30 days based on the completion of starting jobs. Would it be possible in autosys, to dynamically set the must start time for the jobs which don't have starting time rather they are dependant on starting conditions?
I use something like this in my critical jobs. You can try them too, if you want :
must_start_times: "19:01"
days_of_week: mo,tu,we,th,fr,sa,su
start_times: "19:00"
I know orchard has its default scheduler running in every minutes. Does it mean that the minimal interval is 1 minutes?
If I want a task to run in every 20 seconds, how can I make it.
Thanks
You can open the file src\Orchard.Web\Config\Sites.config to uncomment the Delay between background services executions paragraph. Here you can set the interval.
I am using cron expressions for my application. I want to build a cron expression to run at every 40 seconds starting from now.
For example; If my job starts at 3.05 then job should be fired at 3.45,4.25,5.05 etc..how to write cron expression for this case.
Can anyone help me?
You can use a CronTrigger if you're interested in calendar-based schedulers (for example every 40 seconds Monday to Friday, or every Tuesday etc) or a SimpleTrigger if you just want it to fire every 40 seconds ad infinitum.
There are plenty of examples here: http://quartznet.sourceforge.net/tutorial/lesson_5.html
This trigger may help you but have a look through the rest of the examples (plenty of them on the web!):
ITrigger trigger = TriggerBuilder.Create()
.WithIdentity("trigger1", "group1")
.WithDailyTimeIntervalSchedule(x => x.OnMondayThroughFriday().WithIntervalInSeconds(40))
.Build();
I'm trying to create a cron expression that will trigger a job according to the time I get, and every X minutes. both start/end time and the minutes intervals are parametrs I get from the user. for example:
start time: 09:15
end time: 19:35
minutes interval: 15
I want the job to start at 09:15 and to be triggred every 15 minutes, so the last job will actually be at 19:30 (because it can't be after 19:35).
my problem is that I dont know how to include the minutes of the start/end time..
How is it possible to create this kind of expression?
Thank's In advance.
I don't think that it is possible to meet your requirements in a single cron expression, as each time component (hours/minutes/seconds etc) is handled independently.
Perhaps the simplest approach would be to have a trigger for running every 15 minutes, and enable/disable this trigger at 09:15 and 19:35 (e.g. using additional triggers).
Alternatively you could have a trigger fire every 15 minutes, and procedural logic attached to this trigger which checks if the current time is between 09:15 and 19:35 before doing any work.
You don't need CRON, simple trigger will do. Check out Lesson 5: SimpleTrigger. This should work for your situation:
trigger = newTrigger()
.startAt(nineFifteen)
.endAt(nineteenThirtyFive)
.withSchedule(simpleSchedule().withIntervalInMinutes(15))
.forJob(someJob)
.build();