Setting up the Scheduler (cron job)
This allows to properly maintain and prune the large database tables, to keep the Antispam Blacklist automatically up to date or to send Users reminder emails when they have unread messages for example… See Scheduled Tasks Reference for a list of available tasks to be scheduled.
Now, b2evolution is written in PHP, which means it cannot actually wake up all by itself. It needs the operating system waking it up. This is typically done with what is called a "cron job".
There are several methods to set up such a "cron job". Basically, you need to make sure
/cron/cron_exec.php is called on a regular basis, such as once every few minutes.
Here is a list of options to achieve this, in order of preference (first is best):
- Set up a Linux cron job, i-e: let Linux call php on a regular basis
- Set up a cPanel cron job, i-e: let "cPanel’ call the scheduler through the webserver on a regular basis
- Set up a Windows Scheduled Task, i-e: let Windows call cron_exec.php on a regular basis
- or Set up a web watch dog that will ping
- or Open that page in a browser and let it refresh itself.
How often should the cron job run?
Unless your web host doesn’t allow you to do so, we recommend running the cron job that wakes up b2evolution every 1 to 5 minutes.
Remember, this is just a very small wake up call. When woken up, b2evolution’s Scheduler will check if there is a pending Scheduled Job that has reached the time to be executed.
- If yes, it will execute that task, exit and go back to sleep. The time this takes depends on the task being executed.
- If no, it will immediately exit and go back to sleep. This takes virtually no time at all. This has a lighter load on the system than a typical request from Google-bot or an attempt from a spam-bot to post a comment on your site.
Warning: The following assumes you have your own Linux server with root access. Blindly following this procedure may lead to breaking your Linux setup. DO NOT do this if you don’t understand it. Use this page only as a guideline. Running the…
This solution isn’t as good as setting up a Linux cron job by far, but we mentioned it since cPanel is very widespread and somewhat easier to set up. So if your host uses cPanel as a web configuration interface, you can go to the "cron…
Warning: The following assumes you have administrative access to the Windows server where b2Evolution is served from and that the Task Scheduler service is enabled. These instructions are valid for Windows Server 2000 and 2003. They will probably work…