-1

Need your help.

I need to run the CRON jobs on my local host as i am fetching feeds using RSS feeder. Please suggest how this can be achieved.

Thanks for your help.

3 Answers 3

1

Take a look to this simple manual. This explains you how Cron works and how to add tasks to your crontab.

EDIT

Asuming you are on GNU/Linux, edit your crontab:

$ crontab -e

And add at the end the following line to execute it every minute:

*/1 * * * * /usr/local/bin/php -q /route/to/your/script.php

Make sure that your php executable is in /usr/local/bin

2
  • Actually i need to run the CRON from my LOCALHOST. Please suggest how to achieve this.
    – gourav
    Nov 27, 2010 at 16:49
  • 'crontab -e' will open the cron list for your username on your host. Assuming this is a Linux question.
    – Sairam
    Nov 27, 2010 at 17:09
1

If you can try to divide your problem into two, it might be easier to solve for you:
-Writing a script which fetches the rss feed and does whatever you want it to do
-Scheduling the run of that script using a cron job.

These two parts are usually independent of each other.

Are you already done with the first part? Do you have a script which can do the fetching?

If it is ready already. What type of script is it? Perl,python, something else?

UPDATE: So you want to call a PHP script on a schedule using cron jobs.

You'll probably get permission errors in your first tries, so chmod your php script to 0755.

Open up your terminal and try the code examples here.

Once you find a working command the first part is complete.

Now with the easy part.
Type crontab -e
Press insert

Let's say within the above examples the "wget http://www.domain.com/file.php" worked for you, then type in:
*/5 * * * * wget http://www.domain.com/file.php

In my terminal, I need to press esc-shift and press z two times to close the crontab. If it works for you too great. You will get one line output saying crontab installed. Job done. Every five minutes your php script will work.

2
  • thansk for your reply...
    – gourav
    Nov 27, 2010 at 17:07
  • i am done with the first part. need to Job schedule (CRON) to be done on my local Host. i was using PHP and MySQL. Please suggest how to go about
    – gourav
    Nov 27, 2010 at 17:09
0

if you're working on a Windows environment, the easiest way to achieve this would be to set up a scheduled task to execute the PHP script that will fetch your RSS data (using the php executable - see here)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .