<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Greetings,<br><br>Happy new year to all of you,<br><br>During the december presentation, I argued that expect was useful<br>to non-programmers (end-users) as well. <br><br>Here's a little script that automates resetting ADSL. One can use cron<br>to run it periodically, or alternatively extend the expect script using<br>looping constructs.<br><br>It's pretty useful when you need to get a new IP for services such as rapidshare<br>that force you to wait after downloading the first file.<br><br>Please note that's my ADSL's setup is a little bit different from typical<br>installations.<br><br>The ADSL modem acts as a bridge (L1/L2), and a small pentium 1 is used<br>for initiating pppoE requests (the pentium 1 box gets the dynamic public<br>IP).<br><br>The script may be adapted to your modem's telnet interface :-)<br><br>#!/usr/bin/expect
 -f                                                            <br>set timeout 10<br>spawn chmod 700 fw.exp<br>spawn ssh tontux@192.168.0.0 -p 22<br>expect {<br>    "yes/no" {send "yes\r" ; exp_continue }<br>    "assword"  { send "lugm\r" ; exp_continue }<br><br>    "$ " {send "sudo ifconfig pppoe0 destroy ; sudo sh /etc/netstart pppoe0 ; e\<br>xit\r";exp_continue}<br>    default { puts "OOPS"  }<br><br>}<br><br><br><br></td></tr></table><br>