You are here:  » Help with CRON


Help with CRON

Submitted by madison on Thu, 2006-11-02 09:44 in

Right all feeds are loaded , automated script is loaded that will download the feeds and update.

the only thing i think i need is to sort out a CRON job to do this.

problem is i dont know what a cron job looks like , what type of file it is and where i need to place that file.

can someone please help?

many thanks

Submitted by support on Thu, 2006-11-02 09:59

Hi Madison,

CRON is the name of a process that runs on all Unix / Linux style systems that periodically invokes programs according to a schedule. Those programs (which can be any executable file or script on the server) are what you hear referred to as "CRON jobs", but in reality they are no different to any other program or script - they are just started by the CRON process instead of a normal user.

Therefore, the automation script that you have already created can be setup to become a CRON job - you just have to tell CRON where the script is located and how often you want it executed.

The easiest way to setup a CRON job is through your hosting control panel. If you're using cPanel, here's a tutorial for setting up a CRON job:

http://www.siteground.com/tutorials/cpanel/cron_jobs.htm

A similar tutorial for Plesk is:

http://www.swsoft.com/doc/tutorials/Plesk/Plesk7/plesk_plesk7_eu/plesk7_eu_crontab.htm

In both cases, the "command" you need to enter is the fully qualified path to the automation script that you have created. If you don't know the fully qualified path, you can find it out using the "pwd" (present working directory) command in the same directory as your script. For example, if your automation script is called "import.sh", and in the same directory as import.sh you run the command "pwd" and see this:

$pwd
/home/httpd/vhosts/www.example.com/public_html/htdocs/

...that means that the fully qualified path and command name for your import script is:

/home/httpd/vhosts/www.example.com/public_html/htdocs/import.sh

...which is what you want to setup as the command in your CRON job...

Hope this helps!
Cheers,
David.

Submitted by madison on Thu, 2006-11-02 18:01

many thanks that really helps , partly :)

but i still cant figure out where to add this , as i dont have CPpanel and Plesk ?

i have a dedicated linux server , with neither of the above, any ideas?
sorry to be a pain

Submitted by support on Thu, 2006-11-02 22:43

Hi Madison,

Bear with me on this one - if you're not using a control panel you will need to setup CRON via the command line. I'll look into the generic commands required and post back a "mini-tutorial" for you....

Cheers,
David.

Submitted by support on Fri, 2006-11-03 09:43

Hi Madison,

Having thought about this the command line could get quite complicated so I would actually recommend installing something like Webmin, which has an easy control panel for configuring cron jobs:

http://www.webmin.com/

Cheers,
David.

Submitted by madison on Fri, 2006-11-03 18:14

many thanks again David , installed webmin

just not sure what to add, there is a input field which is
"Command" and i assume i put the following /user/htdocs/pricesearch/scripts/fetch.sh

then there is a field "Input to command" which i not sure what to add

think this is the final problem then i can leave you alone.

many thanks

Submitted by support on Fri, 2006-11-03 18:17

Hi Madison,

You can just leave input to command blank.

You would use that if you were using cron to schedule a command that required parameters; but in this case there are no parameters so it can be left empty.

Cheers!
David.

Submitted by madison on Fri, 2006-11-03 18:35

thats great , time to try then

David , many thanks for all the help , u r a star

Submitted by madison on Fri, 2006-11-03 20:12

Hi David , have run the Cron job and i get the below error , any ideas what im doing wrong

Output from command /user/htdocs/pricesearch/scripts/fetch.sh ..

/bin/sh: /user/htdocs/pricesearch/scripts/fetch.sh: No such file or directory

Submitted by support on Fri, 2006-11-03 20:15

If it's a standard Linux server I would have thought the path should begin with /home/. It could be:

/home/user/htdocs/pricesearch/scripts/fetch.sh

The best thing to do is to login and try running the script with the full path.

Cheers,
David.

Submitted by madison on Sat, 2006-11-04 14:48

have sorted the path out now , but i now get permission denied? how do i give access for this to work?

/home/user/htdocs/pricesearch/feeds/productsSavapoint.txt.: Permission denied

Submitted by madison on Sat, 2006-11-04 15:08

ok sussed it , i can now run it and it downloads the feed , but looking now at the admin panel in PT u can see the feed has downloaded but it needs registering again, do i have to do this manually with all the feeds if i automate to download everyday?

Submitted by support on Sat, 2006-11-04 19:18

Hi Madison,

No - you should not have to reregister. This would imply that the feeds have been downloaded with a different filename. Are you now seeing two versions of the feeds?

Check that they are being downloaded with the same filename, and then the import script should run the import again without having to re-register.

Cheers,
David.

Submitted by madison on Sat, 2006-11-04 20:23

ok , will check on this , thanks

Submitted by madison on Sun, 2006-11-05 10:14

ok the automated script is all working, but im not actually convinced the feeds are being updated , im not really seeing any increase or decrease in the amount of products per merchant or any price changes.

The date stamp in the modified field is updated but the date stamp in the import field is an old date.

Submitted by support on Sun, 2006-11-05 10:46

Hi Madison,

That does sounds like the import procedure has not been called in your automation script. Do you have the following on (or near) the last line:

cd /path/to/pricetapestry/scripts
php import.php @ALL

Cheers,
David.

Submitted by madison on Sun, 2006-11-05 11:05

i have MODIFIED not all

Submitted by madison on Sun, 2006-11-05 11:36

have changed it to ALL but still the same result

Submitted by support on Sun, 2006-11-05 12:21

Does it work when you run the script manually? (i.e. after logging in via SSH)?

Submitted by madison on Sun, 2006-11-05 14:19

not sure as i dont now how to do that :)

Submitted by support on Sun, 2006-11-05 14:41

I think it could be that your automation script is not running from the /scripts/ directly. Can you double check the "cd" command immediate before running import.php?

Feel free to email me a copy of your automation script and i'll take a look (reply to your reg code or forum registration email)...

Cheers,
David.