 |
 |
 |
 |
| Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum. |

26th June 2008, 05:37 PM
|
|
Registered User
|
|
Join Date: Oct 2005
Posts: 6

|
|
|
How to: Cron command for a URL?
Greetings,
I can't seem to find the correct command when scheduling a cron task to trigger an external php file.
I can use "php /home/account/example.php" to hit a file on my own server but not to hit an external link.
I've tried "links http://dir/example.php" and "lynx -source http://dir/example.php" with no luck.
Any help?
Thanks,
VP
|

26th June 2008, 05:48 PM
|
|
Banned
|
|
Join Date: Jun 2008
Posts: 1,315

|
|
|
i haven't really understand..lol, but if you want to load a webpage, just run wget.
`man wget`
bye
|

26th June 2008, 05:53 PM
|
|
Registered User
|
|
Join Date: Oct 2005
Posts: 6

|
|
|
I must say right off that I am a complete newb. I am using Webmin on Core 7 so all I have is this command field in the "Scheduled Cron Jobs" section. So command line stuff is out for me. Thanks though.
Any other ideas?
|

26th June 2008, 05:59 PM
|
|
Banned
|
|
Join Date: Jun 2008
Posts: 1,315

|
|
Well, if "php /home/account/example.php" works...
try as i said... read the manual of wget, because i don't wanna waste my time to read it now...LOL
but i think something like
Code:
wget -q -O /dev/null http://google.com
will work....
|

26th June 2008, 06:18 PM
|
|
Registered User
|
|
Join Date: Oct 2005
Posts: 6

|
|
|
Thanks bee but I'm not trying to download a file and wget seems to be for just that; "GNU Wget is a free utility for non-interactive download of files from the Web."
Am I not using it correctly? I only need to run a URL that will refresh a page for me at set intervals.
|

26th June 2008, 06:30 PM
|
|
Banned
|
|
Join Date: Jun 2008
Posts: 1,315

|
|
Quote:
|
Originally Posted by VestanPance
I'm not trying to download a file
|
Quote:
|
Originally Posted by VestanPance
I only need to run a URL that will refresh a page for me at set intervals.
|
in order to do that: you need to download the web page you want to hit.... 
How can you see or just hit a document, if you aren't going to download it?
As cron is a service, you'll not see the output of wget, but you can save the page content in a file... or just load the page and then discard its content. (so you'll hit/touch the webpage and nothing else).
|

26th June 2008, 06:38 PM
|
|
Registered User
|
|
Join Date: Oct 2005
Posts: 6

|
|
|
Weel I quess I am still a bit confused. It seems to me that there should be a difference between downloading a script and running a script. I do understand that a script needs to be downloaded to be run...but like I said I am a newb to Linux.
Well when I just use wget it runs OK but it says:
"Length: unspecified [text/html]
index.php?option=com_rssfactory: Permission denied
Cannot write to `index.php?option=com_rssfactory' (Permission denied)."
Any ideas on that one?
(Thanks for the help BTW)
Last edited by VestanPance; 26th June 2008 at 06:40 PM.
|

26th June 2008, 06:46 PM
|
|
Banned
|
|
Join Date: Jun 2008
Posts: 1,315

|
|
Quote:
|
Originally Posted by VestanPance
It seems to me that there should be a difference between downloading a script and running a script. I do understand that a script needs to be downloaded to be run...
|
No. You're wrong.
If you are running: php /home/account/example.php
then you are running a server side script.
If you need to load a remote webpage, you don't need to run any script. When your web browser or your command line client (like wget) are going to load the page, the PHP script will be run by the web server!! (like Apache...)
Quote:
|
Originally Posted by VestanPance
but like I said I am a newb to Linux.
Well when I just use wget it runs OK but it says:
"Length: unspecified [text/html]
index.php?option=com_rssfactory: Permission denied
Cannot write to `index.php?option=com_rssfactory' (Permission denied)."
Any ideas on that one?
|
It isn't the full output of wget.... but i think it's about the output file. You need to write the output to another path/filename.
|

26th June 2008, 06:51 PM
|
|
Registered User
|
|
Join Date: Oct 2005
Posts: 6

|
|
Quote:
|
Originally Posted by bee
It isn't the full output of wget.... but i think it's about the output file. You need to write the output to another path/filename.
|
Here is the full output:
"Output from command wget http://www.theURL.com/index.php?opti...&password=pass ..
--10:36:56-- http://www.theURL.com/index.php?option=com_rssfactory
=> `index.php?option=com_rssfactory'
Resolving www.theURL.com... 255.255.255.0
Connecting to www.theURL.com|255.255.255.0|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
index.php?option=com_rssfactory: Permission denied
Cannot write to `index.php?option=com_rssfactory' (Permission denied)."
The URL and IP have been edited by me. I'm not sure what to do from here.
|

26th June 2008, 06:54 PM
|
|
Banned
|
|
Join Date: Jun 2008
Posts: 1,315

|
|
it's because you called wget in a wrong way....
If you need the output file, write:
Code:
wget -q -O /home/wheretosavethefile/file.txt http://www.theURL.com/index.php?option=com_rssfactory
if you want to hit the file, but discard its content, write
Code:
wget -q -O /dev/null http://www.theURL.com/index.php?option=com_rssfactory
so that the file contents get trashed....
|

26th June 2008, 06:57 PM
|
|
Registered User
|
|
Join Date: Oct 2005
Posts: 6

|
|
I do prefer to not save the file so the second option is perfect. however I get this error:
"Output from command wget -q -O /dev/null http://www.theURL.com/index.php?opti...&password=pass ..
No output generated"
|

26th June 2008, 07:03 PM
|
|
Banned
|
|
Join Date: Jun 2008
Posts: 1,315

|
|
Quote:
|
Originally Posted by VestanPance
|
lol, i wrote that solution in the post: #4...
Btw, "No output generated" isn't a error...it's just because there are no outputs! If you want to see useless output remove the "-q" switch. But if you are running wget from cron, having that -q switch (-q=quiet=don't generate any standard output) is recommended.
|

7th July 2008, 10:29 PM
|
|
Registered User
|
|
Join Date: Mar 2008
Posts: 30

|
|
|
Hey there,
im trying to start to write a cron job but i don't quite get it.
I need it to go off every week day (monday - friday) at 4pm server time.
i believe it looks something like this:
wget -q 'http://www.yourwebsite.com/index.php?option=com_acajoom&act=cron'
but i dont know how to get it so that it goes out at those times, could some one help ?
|

9th July 2008, 03:18 AM
|
|
Registered User
|
|
Join Date: Mar 2008
Posts: 30

|
|
|
^Bump ^bump
|

9th July 2008, 04:43 PM
|
 |
Registered User
|
|
Join Date: Nov 2004
Posts: 1,105

|
|
Look at the man page for cron. The first search result in Google for "crontab format" returned this Wikipedia page:
http://en.wikipedia.org/wiki/Vixie_cron#Modern_versions
I would think:
* 16 * * 1,2,3,4,5 yourcommand
would do what you want.
Read the manual.
__________________
IMHO GNOME FTW! BTW KDE WAD? FWIW. HTH. AFAIK YMMV. OMG WTF BBQ! :rolleyes:
Do you like surfing forums but wish people would stop using obscure abbreviations and acronyms?
Then my Firefox/Chrome extension ABBREX is for you!
It automatically adds hover tooltips to abbreviations displaying their meanings on any web page you visit!
Check it out at: http://abbrex.com
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Current GMT-time: 17:21 (Thursday, 23-05-2013)
|
|
 |
 |
 |
 |
|
|