Imported Debian patch 1.0-11
[debian/p10cfgd] / examples / stats / fhgstats
1 #!/usr/local/bin/expect --
2 # a dumb little 'expect' program to check the status of gw.wd0fhg.ampr.org
3
4 set timeout 5
5 set addr "44.32.0.32"
6 set call "WD0FHG"
7 set pass ""
8 set prompt "empire>*"
9
10 puts [timestamp -format %c]             ;# time tag the output
11
12 spawn telnet $addr
13 expect "login: " { send "$call\r" }
14 expect "word: " { send "$pass\r" }
15
16 expect "NET/ROM*"  { send "j \r" }      ;# for now we will just look at ax0
17
18 expect  {                       ;# no easy way to tell that the list is 
19                                 ;# complete so we'll just time out
20         "NET/WRONG*"  {}        ;# looking for we can't find.
21         }
22
23 expect "*"      { send "\r@\r" };# flush the expect buffer and go to sysop
24
25 expect $prompt  { send "uptime\r" }
26 expect $prompt  { send "syncstat\r" }
27 expect $prompt  { send "asystat\r" }
28 expect $prompt  { send "dom db\r" }
29 expect $prompt  { send "route\r" }
30 expect $prompt  { send "exit\r" }
31
32 expect "mode...*"       { }
33
34 expect "*"      { send "\rb\r" };# flush the expect buffer and signoff
35
36 expect "closed*"                ;# wait for the connection to close
37
38 exec sleep 3
39
40 expect eof
41