You are here:  » CRON script from external host


CRON script from external host

Submitted by oneilus on Fri, 2013-11-15 17:11 in

Hi :)

I'm trying to use the cron script to update my feed every night.
My PT website is hosted on simple hosting plan that does not have SSH, However I have an other hosting with SSH include and I want to use this one to call the cron script for my PT website.

So I login in SSH(using Putty), created a new cron("cronUpdate.php")and added the line:

/usr/bin/wget http://example.com/scripts/cron.php

then I tried this cron with the command "php cronUpdate.php"

it shows me the script line in the Putty window but apparently the script is not running because on the PT admin panel the last Imported time is not changed.

Am I doing something wrong ?

Submitted by support on Fri, 2013-11-15 17:19

Hello oneilus and welcome to the forum!

The content of your new file cronUpdate.php isn't valid PHP code, but it _would_ be a valid "shell script", so rather than cronUpdate.php save the same code as cronUpdate.sh

And then, as your CRON command, use:

/bin/sh /path/to/cronUpdate.sh

/path/to/ needs to be the full file system path to the folder in which the cronUpdate.sh script is saved. If you're not sure, you can find this out using the "pwd" (present working directory) command.

Finally, bear in mind that if you have set an admin password in your Price Tapestry installation's config.advanced.php then you will need to supply this password in the ?password= parameter when requesting cron.php over HTTP, e.g.

/usr/bin/wget http://example.com/scripts/cron.php?password=yourpassword

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by oneilus on Fri, 2013-11-15 17:45

Hi David and thank you for this quick reply :))

I created the new cron and run it:

sh cronUp.sh
--2013-11-15 18:33:32-- http://example.com/scripts/cron.php?password=mypass
Resolving example.com... XX.XXX.XXX.XX, XXXX:XXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX
Connecting to example.com|XX.XXX.XXX.XX|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/plain]
Saving to: `cron.php?password=mypass'

[ ] 5,283 30.1B/s in 3m 6s

2013-11-15 18:36:39 (28.3 B/s) - `cron.php?password=mypass' saved [5283]

My feed is still not updated :'(

Submitted by support on Fri, 2013-11-15 17:54

Hi oneilus,

It looks like something significant is being returned, so it would be handy to see what is actually being sent by the remote server. As your command in

/bin/sh /path/to/cronUpdate.sh

...if you replace with;

/usr/bin/wget -O /tmp/output.txt http://example.com/scripts/cron.php?password=yourpassword

(or replace /tmp/output.txt with a known location / file that the CRON process can write to), schedule another job, and then if you could let me know (if you're not sure from) what is contained in the output.txt that should point to the problem....

If you request http://example.com/scripts/cron.php?password=yourpassword manually via your web browser does that work as expected and fetch / import your feed?

Cheers,
David.
--
PriceTapestry.com

Submitted by oneilus on Fri, 2013-11-15 18:15

Thanks :))) problem is SOLVED.
Actually in the admin panel i was looking the " Imported" time instead of the "Modified" time :)