LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   cronjob (https://www.linuxquestions.org/questions/linux-software-2/cronjob-658210/)

xser 07-25-2008 09:32 AM

cronjob
 
Who knows cronjob?

Can i make cronjob to run (for example) spider.php every 30 minutes?

I am going to make search engine's spider which will check links every 30 mins.

colucix 07-25-2008 11:10 AM

Everyone knows cronjob! ;) You have simply to do
Code:

man crontab
man 5 crontab

the former will give a general description of the crontab, the latter will give a description of the crontab file format.

Regarding your requirements, you can edit your crontab (crontab -e) and add an entry like this:
Code:

*/30 * * * * /path/to/php spider.php
where the first field (minutes) means "every 30 minutes". Substitute the /path/to/php with the real path on your machine and the trick is done.

xser 07-25-2008 11:19 AM

10.X my friend ;)

xser 07-26-2008 03:29 AM

Now please more practically

if i want to run http://www.xatchmeruk.com/cron_job.php every 30 minutes what i will write in command field.

colucix 07-26-2008 03:40 AM

I'm sorry, but I don't know much about php. It looks like you have to run a cron job remotely on a web server. The crontab entry on your local machine will be similar to the one above: the time and date fields
Code:

*/30 * * * * /path/to/some/command/here http://www.xatchmeruk.com/cron_job.php
this will run every 30 minutes, each day of the year. Maybe some php expert can be more helpful.

chrism01 07-27-2008 09:06 PM

You'll need the cmd line version of php, ie the one that doesn't rely on being called from/by Apache

lawrence_lee_lee 07-27-2008 09:38 PM

If I would like to have my cron job consists of a number of commands, what should I do? It seems that I can only have a single command in my crontab for each job!


All times are GMT -5. The time now is 01:38 AM.