LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-18-2012, 01:54 AM   #1
pra838
Member
 
Registered: Feb 2010
Location: Sri Lanka
Posts: 50

Rep: Reputation: 0
Unhappy How to run URL from Cron job


Dear All,

I have to configure shell scrip to do following task.

1. There is a URL to run (www.example.com/somthing)
2. This URL must be run every ten minutes in background.(As my view we can do it with Cron Tab).

Best Regards/
PRA838
 
Old 06-18-2012, 02:00 AM   #2
414N
Member
 
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 647

Rep: Reputation: 189Reputation: 189
What do you mean by "running a URL"?
URLs cannot be run...
 
Old 06-18-2012, 12:54 PM   #3
glamiss
LQ Newbie
 
Registered: May 2012
Location: minneapolis
Distribution: rhel 3/4 (soon to add 5)
Posts: 9

Rep: Reputation: Disabled
by "run url" i'm going to assume you want to check it (and not go to some page and run some youtube video or something every ten minutes ). the curl command is useful for this

curl http://www.yahoo.com

i would suggest dumping the output into a file and then grepping explicitly for something you know is constant (like the title). yahoo is a bad example, but it was just an example i used

Code:
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <title>Yahoo!</title>
there you have the title, so the page itself returned (whether the content is what you expected or not is a different question / issue). so in your case, where the page requested is not the top level, (you need the trailing /)

with the wget command, you can get files from a location. so if you were trying to get a constant update of accessible logs or pix or something, you could use that

if you want to get the access code (200, 302, 400, 500), well, i don't know... i have been trying to do this with telnet to get the access code info:
Code:
[glamiss@myserver ~]$ telnet 0 80
Trying 0.0.0.0...
Connected to 0.
Escape character is '^]'.
get /webservice/

HTTP/1.1 200 OK
but i don't know how to dump my telnet output

Last edited by glamiss; 06-18-2012 at 12:56 PM.
 
Old 06-18-2012, 12:55 PM   #4
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
To access a url you have to accept what it sends you. You can throw that data away or whatever. But you must take it. All CGI programs have to return something, so be cool and accept it. Use curl or wget.
Depending on OS, you might be able to open a browser instead (fedora = htmlview).
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Run cron job in every 20 second ust Linux - Newbie 13 01-15-2015 01:01 PM
Debian daily cron job won't run, but does run in cron.hourly. sandersch Linux - General 7 05-24-2012 01:50 AM
Can't get a cron job to run derzok Linux - General 10 12-16-2007 04:00 AM
Loading website URL in a Cron Job njdube Linux - General 5 04-17-2006 11:45 PM
Did my Cron job run? ryedunn Linux - Newbie 2 02-25-2004 08:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:52 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