LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   shell script problem, want to use shell script auto update IP~! (https://www.linuxquestions.org/questions/programming-9/shell-script-problem-want-to-use-shell-script-auto-update-ip%7E-387225/)

singying304 11-28-2005 07:41 AM

want to use shell script auto update IP~!and do a forward
 
sorry about my english.

in my situation.
i am using ddns client programe to change my domain's ip
now,i want to write a shell script to do it

i jsut want to let shell script know
if my current ip isn't same as before 10 minute's ip then run ddns programe to update the newest ip.

how to write it? and how to run the *.sh ervery second?


other problem,
every time run crond successed,then system auto e mail to root@localhost
also ,i want to write script to mail to /dev/null

thanks in advance

perfect_circle 11-28-2005 08:22 AM

for the first one, you can use the sleep command to make your script to sleep and wake up after n seconds. If you do this through an infinite loop, you can make your script run every n second.

singying304 11-28-2005 08:37 AM

Quote:

Originally posted by perfect_circle
for the first one, you can use the sleep command to make your script to sleep and wake up after n seconds. If you do this through an infinite loop, you can make your script run every n second.
i just know little programe logic,but i don't know how to do it...

perfect_circle 11-28-2005 08:46 AM

Code:

#!/bin/sh

while [ 0 ]; do
        echo "Hello world"
        sleep 2
done

if you save this script in a file and give execute permission to the file, when you run it, it will print hello world every 2 seconds.

singying304 11-29-2005 05:32 PM

Quote:

Originally posted by perfect_circle
Code:

#!/bin/sh

while [ 0 ]; do
        echo "Hello world"
        sleep 2
done

if you save this script in a file and give execute permission to the file, when you run it, it will print hello world every 2 seconds.

thanks~

then who can offer me the full script?


All times are GMT -5. The time now is 08:01 PM.