LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 08-11-2003, 03:20 AM   #1
Corellon
LQ Newbie
 
Registered: Jun 2003
Distribution: Redhat 7.3
Posts: 14

Rep: Reputation: 0
Cron Job Problem


Hi I have a question about cron job

is there a way to execute a php script every lest say half an hour ?
I understand that something like:
30 * * * * path/script_name.php will do no good cause i need apache server to execute it... does any one know the command needed for that ?

Thanks
 
Old 08-11-2003, 03:46 AM   #2
AltF4
Member
 
Registered: Sep 2002
Location: .at
Distribution: SuSE, Knoppix
Posts: 532

Rep: Reputation: 31
your script should start with a line like:

#!/usr/bin/php
[.....PHP SCRIPT HERE ....]

and the x-bit should be set and the script should be readable to cron (e.g. chmod ugo+rx /path/to/script)
 
Old 08-11-2003, 03:47 AM   #3
jalal
Member
 
Registered: Aug 2003
Location: .bh
Distribution: Gentoo
Posts: 188

Rep: Reputation: 30
this should work, as PHP by itself doesn't need apache.

from the command line, try:

php yourscript.php

and see if it works. you can then do a cron job for it.
 
Old 08-11-2003, 06:29 AM   #4
codecruncher
Member
 
Registered: Aug 2003
Location: Austria
Distribution: Fedora Core release 2 (Tettnang)
Posts: 37

Rep: Reputation: 15
Well, for PHP to work on the shell without apache, you need to compile it as an cgi. (meaning without --with-apxs)

But you also could do something like
lynx localhost/script.php

that should work as well... I am not 100% if it would work like I wrote it, but I do not that it does, cos I did it like a year ago, once....long time ago...

best regards
Klaus
 
Old 08-12-2003, 03:27 AM   #5
Corellon
LQ Newbie
 
Registered: Jun 2003
Distribution: Redhat 7.3
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks for the help

Followed jalal advice and it worked perfectly, all that is needed is to add php before the script name.

Thanks again.
 
  


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
scp problem in cron job andreolira Linux - General 9 09-08-2008 04:27 PM
cron job problem graziano1968 Linux - Software 7 08-27-2005 12:41 AM
cron job wbatzle Linux - Newbie 2 07-12-2005 04:19 PM
Problem displaying program output when driven by a cron job garmon Linux - Newbie 1 07-22-2004 02:34 PM
problem in cron job setting gauravdream Linux - General 1 02-23-2004 12:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:40 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration