- b2evolution CMS User Manual
- Back-office Reference
- System
- Scheduler
- cPanel Cron Job Setup
cPanel Cron Job Setup
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 jobs" section and create a cron job there.
You are going to set up a command that will be run every minute, every hour, every day, every month… or less if you choose too.
wget Method
The "magic" command to type in is: wget -q -O cron_exec.html http://www.yoursite.com/cron/cron_exec.php
www.yoursite.com
to the Base URL ($baseurl) of your b2evolution installation.wget will simulate a browser hitting the cron_exec.php
page each time it is called (once a minute).
wget will also save the result (the HTML you would normally see in your browser) into a file. By default it creates a new file every time. I don’t know where on the server this will happen, but that’s not something you want to happen. This is why we have included the option "-O cron_exec.html". I will make sure the output always goes to the same file named cron_exec.html.
We have included the option "-q" in the command above. It means "quiet"; in other words: "don’t talk to me, don’t generate an email to tell me what you did".
PHP CLI Method
If allowed by your web host, this is a better command line: php /path/to/your/blog/cron/cron_exec.php > /dev/null
It will tell cron to run /cron/cron_exec.php
as a PHP by using the command php
(the CLI Command Line Interface version of PHP). If the shortcut does not work for your host, you can use /usr/bin/php
or /usr/local/bin/php
.
The > /dev/null
part tells the cron to dump all non-error messages to /dev/null
which is like a ‘blackhole’. You will never see these non-error messages again.
Other info
In cPanel, you can also enter an email address where the cron output will send you an email about what happened each time it runs. This is a perfect way to get a new email every minute of the day but it can get boring quite fast. So if you can, leave the email address empty except maybe for debugging.
If your hosting limits cron job use. You may try webcron service Easycron.com.