Imported Debian patch 1.0-11
[debian/p10cfgd] / examples / stats / ppstats
1 #!/usr/local/bin/expect --
2 # a dumb little 'expect' program to check the status of ppfma.ampr.org
3
4 set timeout 5
5 set addr "44.32.4.2"
6 set call "N3EUA-8"
7 set pass ""
8 set prompt "cos>*"
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 ax0\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 "exit\r" }
29
30 expect "mode...*"       { }
31
32 expect "*"      { send "\rb\r" };# flush the expect buffer and signoff
33
34 expect "closed*"                ;# wait for the connection to close
35
36 exec sleep 3
37
38 expect eof
39