scheduling tasks

Steven Elling ellings at kcnet.com
Sun Jan 19 18:34:29 CST 2003


On Saturday 18 January 2003 22:21, Matthew Freeland wrote:
> What would be even better would be a script that would monitor my
> wan ip address and run the program when it changes.  Could I write a
> shell script that would do this, and if so, could someone give me a brief
> example of how it might be done?

cron is the daemon you want to use.  It or a similar daemon is usually 
installed on any Linux system.  Try a 'man crontab' to read up on 
scheduling programs.

On the side of updating your DNS entry when your IP changes,  most DHCP 
clients have a feature where you can run a script whenever it communicates 
with the DHCP server.

For instance, dhclient by default runs '/sbin/dhclient-script' to configure 
the network interface. In the '/sbin/dhclient-script' script it looks for 
'/etc/dhclient-exit-hooks' and if found sources its contents.  In the 
'/etc/dhclient-exit-hooks' (written by you), it could check variables 
specific to dhclient to see if the IP has changed then run the program to 
update your IP address if so.

Find out which DHCP client you are using and read the man pages or 
documentation on it to determine if it supports a similar feature.  If you 
need some further help, just let us know which DHCP client you are using.




More information about the Kclug mailing list