Scheduled task - Usage Stats Loader not running

When running the scheduled tasks daily via a cron job
the statistics files are never processed. We are running version OJS 3.1.2-1

The schedule_tasks → last_run field does get updated to the current date/time.
When I manually change the scheduled_tasks last_run field for plugins.generic.usageStats.UsageStatsLoader
to the previous day, then the statistics scheduled task will load the data.

I checked the UsageStatsLoader logs and I can see the time span between firing the task is 24 hours exactly, sometimes 24 hours and 1 second . I checked the mysql server time and it’s exactly the same as the application’s time right down to the millisecond so the syncing of the time is not the problem.

I think the problem has something to do with the updating of the last_run time for the UsageStatsLoader or in the checking if the UsageStatsLoader should be run.

Is anyone else experiencing this problem? Any possible solutions other then running the scheduled task cron job every second day?


With a daily cron job there will always be a bit of slip in the time, because the cron job will run at the exact same time, but the job will take some finite amount of time to complete and to record the completion time. It will then not be eligible to run again until 24 hours after that completion time, which is probably after your next cron run.

Note also that the UsageStatistics job will only ever process the previous day’s log, not today’s.

I run the OJS crons hourly. That way the UsageStatistics cron will always run sometime during that day, processing yesterday’s log. The time will slip day-to-day running the UsageStats job at the next hour from the previous day’s run.

The hourly cron also takes care of jobs which can run more frequently, such as CrossRef registration.

Thanks I’ll give that a try.
I thought I remember seeing the usageStatistics last_run field being updated when it shouldn’t be updated but I must be wrong if that’s working for you.