Call cron.php once a day - Magento settings - magento

Like a lot of users i've some problems configuring Magento cronjobs (my cartrules doesn't update properly on Magento 1.8.1. I also modified my cron.php adding $isShellDisabled = true;).
A tried a lot of things, but it doesn't work. Installed AOE scheduler, and i see all my tasks as pending!
My hosting let me to call cron.php once a day (3 am, and it's working, becase it generates the tasks at that time), so i'm wondering if is useless having settings like this:
Generate Schedules Every 15
Schedule Ahead for 1
Missed if Not Run Within 60
History Cleanup Every 120
Success History Lifetime 1400
Failure History Lifetime 1400
If i run manually the cron.php, it generates tasks for a hour, all pending (for example, my cart rules XML are set to update every 15 minutes, so i get 4 cartrules tasks)
If i run it again (after few minutes), all tasks between this time change form Pending to Success.
So, have i to call it at least twice a day? Or i have to change my cron settings?
thank you for the help

Use this cron expression for each hour:
<cron_expr>0 * * * *</cron_expr>
This will make it run at 12.00, 1.00 and so on.
If you want to make it run at 12.30, 1.30 and so on replace 0 with 30

Related

How to do a every 3 months cron job in laravel?

I am using laravel to schedule a job to run every 3 months at 2am, so I created:
$schedule->command('clean:market-history')->cron( '0 0 0,2 ? 1/3 * *');
But according to my research (by using: this reference) this indicates it will run every 3 months starting in January at 2 am. I got most of it right, I do want it to run every three months at 2 am, but if it starts in January does that not mean if I deploy in august, for example, that it wont start running till January?
Some resources stated to use: */3 how ever, the site, linked above, states the same, starting in January at 2 am.
Is this correct or am I missing something? Can some one explain?
If you want to run your command quarterly (First day of Jan, April, July, October) you can use Laravel's pre-canned quarterly function:
$schedule->command('YourCommandHere')->quarterly('02:00')->timezone('America/New_York');
If you want to run this command every three months starting from time of implementation (ie every 3 months starting now) you can use Laravel's cron function that lets you pass a custom cron line and that cron line would look like this:
$schedule->command('YourCommandHere')->cron('0 2 * */3 *')->timezone('America/New_York');
You can configure any iteration of laravel's cron function. Just use the crontab.guru reference I shared below. It's a lifesaver. Also, don't forgot to define timezone as I do if you intend on using a different timezone than what the server is set to.
To get all of the Laravel schedule features review this documentation: https://laravel.com/docs/8.x/scheduling
My most frequently used url to identify what my cron line should look like: https://crontab.guru

What is "INTERVAL=0" means in Oracle Schedular?

My Oracle DBA have setup a task with following repeat_interval:
Start Date :"30/JAN/20 08:00AM"
Repeat_interval: "FREQ=DAILY; INTERVAL=0; BYMINUTE=15"
Can I ask what is "Interval=0" means?
Does it means this task will run daily from 8AM, and will repeat every 15 mins until success?
I tried to get the answer from Google, but what I find is what is Interval=1, but nothing for 0.
So would be great if anyone can share me some light here.
Thanks in advance!
INTERVAL is the number of increments of the FREQ value between executions. I believe in this case that a value of 0 or 1 would be the same. The schedule as shown would execute once per day (FREQ=DAILY), at approximately 15 minutes past a random hour (BYMINUTE=15, but BYHOUR and BYSECOND are not set).
Schedule has nothing to do with whether or not the previous execution succeeded or not. Start Date is only the date at which the job was enabled, not when it actually starts processing.
If you want it to run every 15 minutes from the moment you enable it, you should set as follows:
FREQ=MINUTELY; INTERVAL=15
If you want it to run exactly on the quarter hour, then this:
FREQ=MINUTELY; BYMINUTE=0,15,30,45; BYSECOND=0
If you want it to run every day at 8am, then this:
FREQ=DAILY; BYHOUR=8; BYMINUTE=0; BYSECOND=0

Run schedule every five minutes (like 00:05, 00:10...) in laravel

I want to run the schedule every five minutes.
like 12:00, 12:05, 12:10...n
I'm using the Schedule Frequency Options :
->everyFiveMinutes();
But sometime it will start 12:02, 12:07, 12:12...n It's wrong for me.
So how can I run schedule every five mins special mins like +5?
try this
$schedule->command('your:job')->cron('5 0 * * *');
The command in this like will be executed at the five minutes of every day (0h05 or 12h05am) and so on.
You have to express this in cron notation:
$schedule->command('my:command')->cron('0,5,10,15,20,25,30,35,40,45,50,55 * * * *');

Magento 1.7 - Cron.php: too late for the schedule

I created some modules to be executed by magento cron but i get always the error.
The numbers:
Cron.php gets executed every 5 minutes
system/cron/schedule_generate_every = 15
system/cron/schedule_ahead_for = 30
system/cron/schedule_lifetime = 15
The module cronjobs should be executed every 5 minutes.
They are added correct to cron_schedule to be executed i.e. at 2014-01-16 16:40:00, 2014-01-16 16:45:00, 2014-01-16 16:50:00 ...
But on execution in 16:50 i get lots of errors. exception 'Mage_Core_Exception' with message 'Too late for the schedule.' also for jobs in the future.
Perhaps: our local time is 17:50, server time 16:50. But i can't remember we had this issue before on other cronjobs.
If the cronjob runs every 5 minutes, try this configuration:
Generate Schedules Every 5
(enter here the cronjob execution time, in this case 5 minutes)
Schedule Ahead for 125
(based on cronjob execution time plus the maximum time one job needs. For example: sitemap generation takes 120 minutes, then enter 120 minutes + 5 = 125 minutes)
Missed if Not Run Within 180
(runtime of the longest process, for example: an import takes 120 minutes, then enter 120 minutes + 60 minutes - because sometimes there is a difference between mysql and server time)
History Cleanup Every 10
(minimum cronjob execution time = 5 * 2 = 10 minutes in this case)
Success History Lifetime 1440
(duration of cronjob storage, to proof if everything works fine. 1440 = 24 hours)
Failure History Lifetime 1440
(duration of cronjob storage, to proof if there is an error. 1440 = 24 hours)
And last but not least, install AOE-Scheduler for a visual inspection of your cronjobs.
http://www.magentocommerce.com/magento-connect/aoe-scheduler.html

quartz spring cron trigger fire immediately

I have a spring application that uses quartz cron trigger. I have given the following for frequency 0 0/20 * * * ?.....once every 20 min. But i want the first one to run immediately. Right now, when I start the application, it runs after 20 min. I was hoping it would run asap and then after 20 min.
Thanks in advance.
It sounds like you want to use an interval trigger (SimpleTrigger in Quartz can do the job).
The CronTrigger wants you to specify the minutes at which to run.
So your trigger schedule says: start at 0 minutes, and run every 20 minutes after that until the hour is over. Then start at 0 again.
But with the SimpleTrigger, you say - start now and run every 20 minutes.
Here is a tutorial on SimpleTrigger:
http://quartz-scheduler.org/documentation/quartz-2.x/tutorials/tutorial-lesson-05
Here is a tutorial on CronTrigger:
http://quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger
You don't need CRON expression (and Quartz at all!) to run given code every 20 minutes. Just use fixed rate (Spring built-in):
#Scheduled(fixedRate=20 * 60 * 1000)
That's it! By default first invocation happens immediately, second after 20 minutes. Since Spring 3.2 you can even say initialDelay=10000 to run for the first time after exactly 10 seconds.
If you really want to use Quartz, check out SimpleTrigger.

Resources