LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-28-2005, 07:41 AM   #1
singying304
Member
 
Registered: Feb 2005
Posts: 106

Rep: Reputation: 15
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

Last edited by singying304; 11-28-2005 at 07:45 AM.
 
Old 11-28-2005, 08:22 AM   #2
perfect_circle
Senior Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Slackware, arch
Posts: 1,783

Rep: Reputation: 53
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.
 
Old 11-28-2005, 08:37 AM   #3
singying304
Member
 
Registered: Feb 2005
Posts: 106

Original Poster
Rep: Reputation: 15
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...
 
Old 11-28-2005, 08:46 AM   #4
perfect_circle
Senior Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Slackware, arch
Posts: 1,783

Rep: Reputation: 53
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.
 
Old 11-29-2005, 05:32 PM   #5
singying304
Member
 
Registered: Feb 2005
Posts: 106

Original Poster
Rep: Reputation: 15
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?
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
auto execute shell script on startup slackwbas Slackware 9 02-27-2005 10:26 AM
Auto-Executing Shell Script on boot benrose111488 Linux - Software 5 12-18-2004 12:52 AM
auto execute shell script ykirankumar Linux - Software 3 09-22-2004 07:23 AM
shell script fo run auto job in cron JolynnMarie LinuxQuestions.org Member Intro 0 04-28-2004 11:21 AM
How to Shell Script auto ftp connection? mtn356 Linux - General 4 03-18-2004 07:31 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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