5751003 [rkeene@sledge /home/rkeene/devel/old/tcl]$ cat -n pppchange.tcl
   1: #!/usr/bin/tcl
   2: # Change this to what you want to be executed, \$IP being the new IP
   3: set Execute "echo \$IP | mail joo@schmoo"
   4: 
   5: set NewIp "0.0.0.0"
   6: set iface 0
   7: while {1} {
   8:   set meep [split [exec /sbin/ifconfig] \n]
   9:   foreach mp $meep {
  10:     if {[string range [lindex $mp 0] 0 2]=="ppp"} { set iface 1 }
  11:     if {[lindex $mp 0]=="inet" && $iface} {
  12:       set word [split [lindex [split [lindex $mp 1] :] 1] .]
  13:       set OldIp $NewIp
  14:       set NewIp "[lindex [split [lindex $mp 1] :] 1]"
  15:       set IP $NewIp
  16:       if {$OldIp != $NewIp} {
  17:         catch { system [subst $Execute] }
  18:       }
  19:       set iface 0
  20:     }
  21:   }
  22:   sleep 60
  23: }

pppchange.tcl is a Tcl script I wrote to email you when your PPP IP changes.
5751004 [rkeene@sledge /home/rkeene/devel/old/tcl]$

Click here to go back to the directory listing.
Click here to download this file.
last modified: 2000-01-30 05:29:25