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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
11-30-2009, 04:36 PM
|
#1
|
LQ Newbie
Registered: Nov 2009
Posts: 7
Rep:
|
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.
|
|
|
11-30-2009, 05:01 PM
|
#2
|
LQ Addict
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,157
Rep:
|
Welcome to LQ
You answer could be here
|
|
|
11-30-2009, 05:11 PM
|
#3
|
LQ Newbie
Registered: Nov 2009
Posts: 7
Original Poster
Rep:
|
Quote:
Originally Posted by Didier Spaier
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
|
|
|
11-30-2009, 05:48 PM
|
#4
|
LQ Addict
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,157
Rep:
|
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.
|
11-30-2009, 06:45 PM
|
#5
|
LQ Newbie
Registered: Nov 2009
Posts: 7
Original Poster
Rep:
|
Quote:
Originally Posted by Didier Spaier
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
|
|
|
All times are GMT -5. The time now is 05:52 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|