LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Use curl to load a page every 5 seconds (https://www.linuxquestions.org/questions/linux-newbie-8/use-curl-to-load-a-page-every-5-seconds-772534/)

xxdxhxx 11-30-2009 04:36 PM

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.

Didier Spaier 11-30-2009 05:01 PM

Welcome to LQ

You answer could be here ;)

xxdxhxx 11-30-2009 05:11 PM

Quote:

Originally Posted by Didier Spaier (Post 3774930)
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

Didier Spaier 11-30-2009 05:48 PM

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 :confused:

xxdxhxx 11-30-2009 06:45 PM

Quote:

Originally Posted by Didier Spaier (Post 3774972)
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 12:03 AM.