You are here:  » Cron Automation


Cron Automation

Submitted by Stew on Sun, 2016-04-24 13:25 in

Hi David,

Wondering if you might be able to shed any light on the below,

Have setup a cron job with the command line:

/home/mypath/public_html/pt/scripts/cron.php

Am getting an email back when the cron loads of:

Subject: Cron /home/mypath/public_html/pt/scripts/cron.php
/home/mypath/public_html/pt/scripts/cron.php: line 1: ?php: No such file or directory
/home/mypath/public_html/pt/scripts/cron.php: line 2: syntax error near unexpected token `0'
/home/mypath/public_html/pt/scripts/cron.php: line 2: ` set_time_limit(0);'

No quite sure what's happening here and why the 'No such file or directory' on line 1,

Any ideas?

Stew

Submitted by support on Tue, 2016-04-26 15:07

Hello Stew,

The errors indicate that the shell (the Linux process that runs cron jobs) is interpreting cron.php as a shell script. Instead, the CRON command line should be a cd (change directory) command to the scripts/ folder, followed by a php (normally /usr/bin/php) command to run cron.php, for example;

cd /home/mypath/public_html/pt/scripts/;/usr/bin/php cron.php

The path to php may vary slightly, but the /pt/admin/ > Setup > CRON page should display the exact command to use based on your file system and php command line program location...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Stew on Tue, 2016-04-26 21:25

Hi David,

OK great, many thanks for looking at that, all makes sense now :-)

Have added in the correct cron command and it looks to be working.

One thing is within the feed area I have 2 feeds added to the 'automation tool' area, for these two when the cron runs they don't seem to import - the import buttons stay green? but the other feeds are ones which I had previously manually FTP'd to the feeds area.

Screenshot here:

{link saved}

Should these two feeds be importing with the others?

The cron ran at:

2016-04-26 16:10:09

Many Thanks,

Stew

Submitted by support on Wed, 2016-04-27 08:09

Hello Stew,

Neither of the feeds looks as if they are particularly large (both fetched within 2 seconds) however if this were not the case my first line of investigation would be whether cron.php had timed out (process terminated by the server) after the fetch process but before the first feed had completed importing.

However there is another possibility which is that the import process triggered a resource limit (e.g. processor load) which caused the script to be terminated, in which case the 1 second sleep every 100 products mod from this commment normally does the trick...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Stew on Fri, 2016-04-29 09:57

Hi David,

Many thanks - that's great - trying the 1 second sleep mod,

Thanks,

Stew