1 jibberjab Jul 10, 2015 23:13
3 jibberjab Jul 11, 2015 13:15
Thanks. I truncated them first via command line and have scheduled the task to run every 28 days for now.
Is there a way to isolate a specific schedule task (pruning hitlog and sessions) into its own cron job? I'd prefer to run that particular schedule on the 1st of every month, rather than every 7 or 30 days. The way scheduled tasks are set up in b2evo I don't see a way to do that since all the tasks are swept up by a single cronjob which runs cron_exec.php at regular intervals, rather than being able to execute specific schedule tasks individually...
jj.
4 mgsolipa Jul 13, 2015 07:30
@jibberjab: You're right, there is no way to set scheduled tasks into their own cron job. But, I don't understand why are trying to do that? You can set your cron, let's say, every 5 minutes, but if the next execution of "Prune hitlog and sessions" is scheduled to the 1st day of each month, it will be completed only on that cron execution, there is no need to set a different cron job only for that task.
5 jibberjab Jul 13, 2015 13:16
How do you schedule "Prune hitlog and sessions" for the 1st of every month? When I edit the task, I only see a start date, start time, and repeat frequency. I can do "every 30 days" but not every month has 30 days, so it will quickly be skewed.
jj.
6 mgsolipa Jul 14, 2015 19:18
@jibberjab wrote:
I can do "every 30 days" but not every month has 30 days, so it will quickly be skewed.
You got me! :oops:
What if you set 12 different tasks (one for the first day of each month) and select a Repeat every value of 1 year? Does it make sense?
Maybe it's a bit annoying, but it took me 5 minutes to set all the jobs that you see in the screenshot above.
7 jibberjab Jul 15, 2015 02:59
I like creative solutions like that.. it's a bit messy but probably the best approach given the limited options. Maybe it's a good feature request since "First day of the month" is a common scheduling cycle for these types of tasks.
jj.
8 jibberjab Sep 20, 2015 18:53
I'd like to re-address this topic to make sure I understand how scheduled tasks are actually executed in relation to the underlying cron job, because I have a hosting account routinely hitting a 2048 IOPS limit and there are only 3 b2evo blogs running on the entire account. The traffic is still fairly low so the only thing the host and I can figure is that scheduled tasks are somehow accumulating inefficiently and creating a severe bottleneck on the db server...
If I have the following b2evo tasks scheduled:
Task 01: 02:00:00 repeat hourly
Task 02: 03:00:00 repeat daily
And a cron job set to run at
5
My questions and presumptions:
- At 02:00:00 no tasks are executed. Task 01 goes into a "waiting" state?
- At 02:05:00 Task 01 is executed?
- At 03:00:00 no tasks are executed. Task 01 and Task 02 go into a waiting state?
- At 03:05:00 Task 01 and Task 02 are executed?
- At 04:00:00 no tasks are executed. Task 01 goes into a waiting state?
- At 04:05:00 Task 01 is executed?
So basically, am I correct in that once a b2evo Scheduled Task trigger-time has been crossed, it waits for the next cron execution and then runs?
jj.
9 fplanque Sep 22, 2015 00:16
Tasks don't really go into a waiting state, they just get executed when the Scheduler is called and the execution time has arrived or has past.
Please see: http://b2evolution.net/man/installation-upgrade/advanced-setup/setting-up-the-scheduler/
@jibberjab that job prunes records from
evo_hitlog
,evo_sessions
andevo_basedomains
, and the views count is saved into theevo_items__item
table, so it's safe to execute the job.As always, make sure to have a backup before to manipulate your data.