LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 07-25-2008, 10:32 AM   #1
xser
LQ Newbie
 
Registered: Jul 2008
Posts: 3

Rep: Reputation: 0
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.
 
Old 07-25-2008, 12:10 PM   #2
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
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.
 
Old 07-25-2008, 12:19 PM   #3
xser
LQ Newbie
 
Registered: Jul 2008
Posts: 3

Original Poster
Rep: Reputation: 0
10.X my friend
 
Old 07-26-2008, 04:29 AM   #4
xser
LQ Newbie
 
Registered: Jul 2008
Posts: 3

Original Poster
Rep: Reputation: 0
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.
 
Old 07-26-2008, 04:40 AM   #5
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
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.
 
Old 07-27-2008, 10:06 PM   #6
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,311

Rep: Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040
You'll need the cmd line version of php, ie the one that doesn't rely on being called from/by Apache
 
Old 07-27-2008, 10:38 PM   #7
lawrence_lee_lee
Member
 
Registered: May 2007
Posts: 141

Rep: Reputation: 16
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!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cronjob help meeh Linux - General 1 03-26-2004 12:41 PM
Cronjob engnet Linux - Networking 6 03-03-2004 10:21 AM
cronjob ugob Linux - Software 0 03-03-2004 10:20 AM
Su in a cronjob michedlp Programming 3 11-06-2003 09:30 AM
cronjob FastEddy Linux - General 1 04-12-2003 10:52 PM


All times are GMT -5. The time now is 08:58 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration