PDA

View Full Version : Cron Jobs setup



Elena
September 22, 2009, 01:06 PM
In this short manual we’ll guide you through configuring cron in cPanel hosting. If your hosting account doesn't have cPanel you can configure it using ssh, which supposes you have required skills otherwise we recommend contacting your hosting helpdesk. You need it for execution different tasks like sending notifications about expired ads, removal of temporary data and other tasks. Cron sends notifications to the Administrator with reports of tasks implemented.


1. Log into cPanel;
2. Find and open Cron Jobs Manager:
3. Check what is your document root path, which is necessary for setting a correct cron task. You can do it by checking the system info (Admin Panel > System Info).

Find DOCUMENT_ROOT

Add cron/index.php to the end of the DOCUMENT_ROOT line; you’ll get something like:

/home/website/public_html/cron/index.php

This is a server path to the cron file that needs to be run.

4. Select an interval to run the cron file; we recommend setting daily midnight.

5. Enter a command to run the cron file:

php /home/website/public_html/cron/index.php

In some cases you have to give an exact path to PHP in the system:

/usr/local/bin/php

It may be different in your system; so if you have any problems getting the right path to PHP contact your hosting helpdesk.

You may enter your email to receive server notifications to make sure it runs properly. To disable cPanel cron notifications you have to replace your email with your account username. Emails may be helpful if you're not sure about a server path or a path to the PHP file, once cron is up and running you can disable cPanel cron notifications.

Flynax cron file also sends email reports about tasks done, for example how many listings expired, data removed etc.

Ivan Amador
June 9, 2015, 04:27 AM
Hi!

I was getting this error when setting the cron job:

(via ssh) -> PHP Fatal error: Call to a member function url() on a non-object in /var/www/vhosts/domain_name.com/httpdocs/cron/index.php on line 297

I opened this file ...cron/index.php and changed this code:



$update_link = $details_link = RL_URL_HOME;
$details_link .= $reefless -> url('listing', $listing);


for this one:



$update_link = $details_link = RL_URL_HOME;
if (!empty($reefless)) {
$details_link .= $reefless -> url('listing', $listing);
}



After that, it started to work! ;)

Ivan

Mike
June 9, 2015, 07:01 AM
If you have same problem as Ivan, please fix it as below:

Open cron/index.php find code and make changes




function performAction( $action )
{
global $rlDb, $rlActions, $rlSmarty, $rlCategories, $rlListings, $config, $pages, $statistics, $reefless; //add $reefless to this line

Bagus Sugianto
June 13, 2015, 10:30 PM
I've changed but still there is an error in admin


$update_link = $details_link = RL_URL_HOME;
$reefless
$details_link .= $reefless -> url('listing', $listing);
}


and this

global $rlDb, $rlActions, $rlSmarty, $rlCategories, $rlListings, $config, $pages, $statistics, $reefless;

Rainer Schwartz
June 29, 2015, 03:50 PM
Hello, I was trying to set up a cron job for the first time and am running into the issue. It reposrts the following:

<b>Parse error</b>: syntax error, unexpected '&', expecting T_VARIABLE or '$' in <b>/homepages/42/d557186969/htdocs/includes/classes/reefless.class.php</b> on line <b>806</b><br />
If I -just to test it- change the source code it goes over it and halts at the next obstacle:

<b>Parse error</b>: syntax error, unexpected '=', expecting ')' in <b>/homepages/42/d557186969/htdocs/includes/classes/reefless.class.php</b> on line <b>1005</b><br />
I did not try any further.

The install I have is a new 4.4 installation after having had troubles with the upgraded 4.3 -> 4.4 site.
I have however imported the old database.
Any ideas?

Jose carlos Picon davila
July 3, 2015, 01:07 PM
Hello

Yesterday I received this error

PHP Fatal error: Call to a member function getProfile() on a non-object in /var/www/vhosts/domain_name.net/httpdocs/cron/index.php on line 587

Fatal error: Call to a member function getProfile() on a non-object in /var/www/vhosts/domain_name.net/httpdocs/cron/index.php on line 587

Regards

Viktor
July 4, 2015, 09:24 AM
Hello Jose,

Would you please send ftp access to my PM and I will check and solve it ASAP.

Apostolos Fotsis
July 31, 2015, 04:10 PM
From my hosting hepldesk received this : To create a cron job you should first specify which cron file should be used for this purpose as I currently see 2 files:

Code:
/public_html/domainname.com/plugins/shoppingCart/cron.php
/public_html/domainname.com/plugins/payAsYouGoCredits/cronAdditional.php


Further more you should note that when setting up a cron job the time for executing such action should not be less than 30 minutes.
How to configured cron jobs?
Thanks

Naser Sultan
January 12, 2016, 07:19 AM
In my site this command worked on shell/ putty /( Assist by Valery)
Crontab -e
*/60 * * * * /usr/bin/php5 -q /var/www/mysite/cron/index.php >/dev/null 2>&1
(Its ubuntu and vps server - there is no cpanel. i used command prompt)

Peter Harts
February 7, 2016, 08:09 PM
Hello,

I am setting up the Escort Agency, but there goes something wrong in the cronjob. I get a error mail with this:

PHP Warning: session_start(): open(/var/lib/php5/sessions/sess_hp5adsblhve7l9ae5qk5c87r26, O_RDWR) failed: Read-only file system (30) in /storage/web/public/sites/www.xxxxxxx.nl/includes/control.inc.php on line 32

The xxxxxxx is my domain name

How to resolve this problem?
Thanks!

Muller Claus
October 17, 2016, 09:04 AM
Please provide fix for error from code

PHP Fatal error: Call to a member function getProfile() on a non-object in /www/*****/cron/index.php on line 593


$account_info = $rlAccount -> getProfile((int)$listing['Account_ID']);

Miroslav Kubacak
April 25, 2017, 10:02 PM
this script is without input parameters?

Curtis
April 26, 2017, 05:56 AM
this script is without input parameters?

Hello Miroslav,

Yes, you set the time period and path only.

Mario Gutierrez
April 29, 2017, 08:58 PM
I need help. cron jobs don't run

Viktor
May 1, 2017, 03:38 AM
Hello Mario,

If you want you can send cpanel or other panel to my PM and I will check your cron command.

John Napoletano
May 13, 2017, 05:26 AM
cPanel users can select once per minute (or five minutes) from the Common Settings drop down to run the cron. Upon success or failure notification, edit the cron job settings to once per day as instructed. This will run the cron removing the alert in your admin dashboard.

David Mundle
October 17, 2017, 07:54 PM
Hay Guys

Can someone confirm what the cron jobs settings are i am using cpanel as i am having trouble understanding the post here. I am not a programmer and just starting out on this project so i need to know the correct cron settings to place into cpanel.

Thanks

David Mundle
October 19, 2017, 01:55 PM
No reply anybody at all can answer my question here????????????

Bahram Soltanirad
October 19, 2017, 01:59 PM
Easiest way is Viktor's answer.

Anass Habrah
October 23, 2017, 09:11 AM
how I can add recount listing for "Recalculate the number of listings in all categories" in my server corn?

Viktor
October 23, 2017, 10:20 AM
Hello David,

At first please read this post: http://forum.flynax.com/showthread.php?3-Cron-Jobs-setup&highlight=cron


Hello Anass,

Recount listings doesn't exist in the cron by default, If you want we can implement it for you. I suggest you create new ticket with the request,

Gen82
October 23, 2017, 02:56 PM
Hello Viktor and member.
Is suggested Scheduled execution of cronjob from other external resource example cron-job(dot)org? have many years use this service without problems, to others projects (code) mean.

Viktor
October 24, 2017, 11:36 AM
Helo Gen,

Would you please show us example. And why do you want to run cron from external resource?

Gen82
October 24, 2017, 04:15 PM
Hello, Cose is free and simple on usage.Have try it over SSH service but nothing for me. (mean for flynax site usage)

Can Atakan
August 18, 2020, 04:51 PM
Cron JOB error

Viktor
August 19, 2020, 02:22 AM
What an error?

Can Atakan
August 19, 2020, 06:40 PM
Not Works ,
I get the message on Flynax admin menu all the time that I should run Cron Job, even though I have set it to Spanel Cron Job.

Viktor
August 20, 2020, 02:19 AM
Maybe you set it up wrong. Would you please show us cron line which you added.

Milea Ionut
September 9, 2021, 03:34 PM
Hi all,

I have a fresh Flynax install and tried to add a cron job. I tried to run it, but I received the following error:


PHP Fatal error: Uncaught Error: Undefined constant "RL_LANG_CODE" in /home/domainname/public_html/includes/classes/reefless.class.php:1442Stack trace:
#0 /home/domainname/public_html/cron/index.php(46): reefless->setLocalization()
#1 {main}
thrown in /home/domainname/public_html/includes/classes/reefless.class.php on line 1442

Does anyone know how to solve this?

Thank you.

Rudi
September 9, 2021, 04:14 PM
Hello,

Make sure that php 7.3 or 7.4 is used for cron jobs (in the cron command) or create a ticket for this