[lugm.org] Addendum for December Technical presentation

Loganaden Velvindron gnukid1 at yahoo.co.uk
Wed Dec 30 13:18:20 UTC 2009


Greetings,

Happy new year to all of you,

During the december presentation, I argued that expect was useful
to non-programmers (end-users) as well. 

Here's a little script that automates resetting ADSL. One can use cron
to run it periodically, or alternatively extend the expect script using
looping constructs.

It's pretty useful when you need to get a new IP for services such as rapidshare
that force you to wait after downloading the first file.

Please note that's my ADSL's setup is a little bit different from typical
installations.

The ADSL modem acts as a bridge (L1/L2), and a small pentium 1 is used
for initiating pppoE requests (the pentium 1 box gets the dynamic public
IP).

The script may be adapted to your modem's telnet interface :-)

#!/usr/bin/expect -f                                                            
set timeout 10
spawn chmod 700 fw.exp
spawn ssh tontux at 192.168.0.0 -p 22
expect {
    "yes/no" {send "yes\r" ; exp_continue }
    "assword"  { send "lugm\r" ; exp_continue }

    "$ " {send "sudo ifconfig pppoe0 destroy ; sudo sh /etc/netstart pppoe0 ; e\
xit\r";exp_continue}
    default { puts "OOPS"  }

}






      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://discuss.lugm.org/pipermail/discuss_discuss.lugm.org/attachments/20091230/99572d36/attachment.html>


More information about the Discuss mailing list