LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
LinkBack Search this Thread
Old 11-30-2009, 04:36 PM   #1
xxdxhxx
LQ Newbie
 
Registered: Nov 2009
Posts: 7

Rep: Reputation: 0
Use curl to load a page every 5 seconds


Hello, thanks for taking the time to read my post.
I am new to Linux. My distro is Ubuntu server 9.04 (no gui).
I have a php file that updates images when it runs. I want to create a script to do this with curl.
I have tested and using curl gives me the desired update, but I don't know how to script this so that I don't have to run it manually from the cli.
I was using vb script and ie to do this on win2k3, but ie kills the cpu, and curl barley raises cpu usage so it would be great if I could script curl to load this page every 5 seconds. Will vb script work on Ubuntu? If there is a script genius reading who knows how to set this up please share, I will be very grateful.
Also, I know this is not the right way to do this, but it is the only way possible for now.

Last edited by xxdxhxx; 11-30-2009 at 04:37 PM.
 
Old 11-30-2009, 05:01 PM   #2
Didier Spaier
Senior Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware-14.0 on a Lenovo T61 6457-4XG
Posts: 3,635

Rep: Reputation: 827Reputation: 827Reputation: 827Reputation: 827Reputation: 827Reputation: 827Reputation: 827
Welcome to LQ

You answer could be here
 
Old 11-30-2009, 05:11 PM   #3
xxdxhxx
LQ Newbie
 
Registered: Nov 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Didier Spaier View Post
Welcome to LQ

You answer could be here
Thanks. I think the problem here is that I want this to run every 5 seconds.

I succesfully created a perl script to do this, but it would be nice if I could set a cron job to start the script/check to see if the script was running, and if not start it
 
Old 11-30-2009, 05:48 PM   #4
Didier Spaier
Senior Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware-14.0 on a Lenovo T61 6457-4XG
Posts: 3,635

Rep: Reputation: 827Reputation: 827Reputation: 827Reputation: 827Reputation: 827Reputation: 827Reputation: 827
I would write a bash script with an infinite loop including:
sleep 5
<check if the perl script is running>
<if not, run it>

[EDIT] at first I wrote wait 5 instead of sleep 5. Probably I was too sleepy, sorry for that

Last edited by Didier Spaier; 12-01-2009 at 01:08 AM.
 
1 members found this post helpful.
Old 11-30-2009, 06:45 PM   #5
xxdxhxx
LQ Newbie
 
Registered: Nov 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Didier Spaier View Post
I would write a bash script with an infinite loop including:
wait 5
<check if the perl script is running>
<if not, run it>
Thats clutch. Got it running. Have the scripts start at bootup via crontab. The script then does the loop forever. 9 scripts running every 5 seconds and I am using less cpu then one script running with ie on 2k3...so happy.

Thanks everyone
 
  


Reply

Tags
curl, script


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Using curl to log in to https page. Chris_no Linux - General 3 09-03-2009 03:50 PM
Wget or cURL code for checking changes to a web page? ewingtux Programming 2 12-16-2008 04:46 PM
i cannt use curl get this page,,,why henryluo Linux - Software 1 03-01-2008 08:07 AM
CURL displays the same form as result page swiftguy121 Linux - Software 0 06-02-2007 08:52 AM
CPU load spikes every ten seconds, causes problems beetlenaut Linux - Software 14 09-04-2004 07:37 AM


All times are GMT -5. The time now is 08:42 AM.

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