Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 26th June 2008, 05:37 PM
VestanPance Offline
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
Reply With Quote
  #2  
Old 26th June 2008, 05:48 PM
bee Offline
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
Reply With Quote
  #3  
Old 26th June 2008, 05:53 PM
VestanPance Offline
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?
Reply With Quote
  #4  
Old 26th June 2008, 05:59 PM
bee Offline
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....
Reply With Quote
  #5  
Old 26th June 2008, 06:18 PM
VestanPance Offline
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.
Reply With Quote
  #6  
Old 26th June 2008, 06:30 PM
bee Offline
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).
Reply With Quote
  #7  
Old 26th June 2008, 06:38 PM
VestanPance Offline
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.
Reply With Quote
  #8  
Old 26th June 2008, 06:46 PM
bee Offline
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.
Reply With Quote
  #9  
Old 26th June 2008, 06:51 PM
VestanPance Offline
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.
Reply With Quote
  #10  
Old 26th June 2008, 06:54 PM
bee Offline
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....
Reply With Quote
  #11  
Old 26th June 2008, 06:57 PM
VestanPance Offline
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"
Reply With Quote
  #12  
Old 26th June 2008, 07:03 PM
bee Offline
Banned
 
Join Date: Jun 2008
Posts: 1,315
Quote:
Originally Posted by VestanPance
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"
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.
Reply With Quote
  #13  
Old 7th July 2008, 10:29 PM
bubaphex Offline
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 ?
Reply With Quote
  #14  
Old 9th July 2008, 03:18 AM
bubaphex Offline
Registered User
 
Join Date: Mar 2008
Posts: 30
^Bump ^bump
Reply With Quote
  #15  
Old 9th July 2008, 04:43 PM
BandC's Avatar
BandC Offline
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
Reply With Quote
Reply

Tags
command, cron, url

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
/etc/cron.daily/000-delay.cron kwhiskers Using Fedora 0 27th January 2007 07:53 PM
Vixie cron , cron fedorabobblue Using Fedora 1 3rd March 2006 04:34 PM
/etc/cron.daily/yum.cron: Error: python-devel conflicts with python < 2.3.4-13.1 productive Servers & Networking 0 20th April 2005 08:51 PM


Current GMT-time: 17:21 (Thursday, 23-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat