This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
install:cron [2013/05/24 09:30] Alia |
install:cron [2014/08/05 11:34] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ======= Oxwall Software Cron Configuration Guide ====== | ||
+ | |||
+ | To have your site working properly you have to create a cron job to run **ow_cron/run.php every minute**.\\ | ||
+ | Cron command could be added via Cpanel/Cron Jobs.\\ | ||
+ | \\ | ||
+ | Depending on hosting settings, cron command can be run via HTTP request or by local execution. | ||
+ | |||
+ | ==== Run cron via HTTP request (Recommended from version 1.3.2 as an easiest way ) ==== | ||
+ | |||
+ | Find "Cron Jobs" icon in your cPanel. If you are not sure where to go check * [[http://docs.cpanel.net/twiki/bin/view/AllDocumentation/CpanelDocs/CronJobs| Cron jobs guide on CPanel]]. | ||
+ | |||
+ | Set needed time in **Add New Cron Job** section. | ||
+ | Use one of the following commands for **Command** field: | ||
+ | |||
+ | <code>wget -q -O /dev/null http://www.yoursite.com/ow_cron/run.php</code> | ||
+ | |||
+ | or | ||
+ | |||
+ | <code>lynx http://www.yoursite.com/ow_cron/run.php</code> | ||
+ | |||
+ | or simply | ||
+ | |||
+ | <code>curl http://www.yoursite.com/ow_cron/run.php</code> | ||
+ | |||
+ | |Note: replace http://www.yoursite.com/ with your actual domain name.| | ||
+ | |||
+ | {{:install:enter-command.png?400|}} | ||
+ | |||
+ | |Note: this method is affordable for common operations made on site regularly (updating user's activity, sending emails and etc). \\ In case when you have heavy tasks, like [[http://www.oxwall.org/store/item/40|import profiles]] or data backup, then it is strongly recommended to [[http://docs.oxwall.org/install:cron#run-cron-locally|run cron locally]] | | ||
+ | |||
+ | ==== Run cron locally ==== | ||
+ | |||
+ | Some hosting companies do not permit local loopback, so using wget, lynx or curl will not work. Or when you have heavy tasks, like [[http://www.oxwall.org/store/item/40|import profiles]] or data backup, then running Cron task will fail due to server limitations. \\ | ||
+ | |||
+ | If this is one of the cases follow steps given bellow to create command to setup cron job via Cpanel/Cron Jobs to run locally. Instructions are given based on assumption that you have ssh access and any ssh client. | ||
+ | |||
+ | |||
+ | - Login to your server via SSH | ||
+ | |||
+ | - Run **cd [path-to-your-Oxwall-homedir]/ow_cron** command to enter the Cron folder | ||
+ | |||
+ | - Run **pwd** command | ||
+ | |||
+ | - You will see the path to the Cron folder (e. g. /home/yoursite/public_html/ow_cron) | ||
+ | |||
+ | - Run **which php** command | ||
+ | |||
+ | - You will see the path to PHP (e. g. /usr/local/bin/php) | ||
+ | |||
+ | Put two paths you got into one: path to PHP/path to Cron folder: | ||
+ | For example: | ||
+ | |||
+ | <code>/usr/local/bin/php /home/site/public_html/ow_cron/run.php</code> | ||
+ | |||
+ | Use this command in **Add New Cron Job** section in cPanel. | ||
+ | |||
+ | Note: contact your hosting company if you have troubles with connecting via SSH. | ||
+ | |||
+ | ==== Online cron services ==== | ||
+ | If your hosting provider doesn't provide a cron utility or you just don't want to spend time configuring it, then you can use some of the online cron services listed below:\\ | ||
+ | |||
+ | * [[https://www.easycron.com/|https://www.easycron.com/]] | ||
+ | |||
+ | ==== Useful links ==== | ||
+ | |||
+ | * [[http://en.wikipedia.org/wiki/Cron | cron wiki]] | ||
+ | * [[http://www.thegeekstuff.com/2011/07/php-cron-job/| adding cron jobs on Linux]] | ||
+ | * [[http://www.imranulhoque.com/miscellaneous/install-php-scripts-as-cron-in-windows/| adding cron jobs on Windows]] | ||
+ | * [[http://docs.cpanel.net/twiki/bin/view/AllDocumentation/CpanelDocs/CronJobs| adding cron jobs on CPanel]] | ||
+ | |||
+ | |||
+ |