PM reset script

Netlink Tech (tech@netlinkcom.com)
Sat, 28 Sep 1996 18:35:02 -0500 (CDT)

Hello all,

My perl skills are limited to using everyones elses scripts. So, I
could sure use some help here. I got the following script from this list
serv and cant seem to get it to work. I finds the idle ports find and
says that is is resetting the ports but never really resets the ports.

I have some Motorola pwr modems and the occasionally "hang". They will
answer and give the connect speed but thats it. They just sit there. I
need to reset the port in order to make the modem usuable again. Very
frustrating!!

Here is the script--FYI if i type "pmcom ts1 "reset s3"" I'm able to
reset s3. So, pmcom is working fine.

Thanks in advance,

Mark Wendlandt
_____________________

#!/usr/bin/perl

# Use at your own risk. I've never had a problem with it, though.

@portmasters = ('ts1'); # put yer portmasters here

$Pmcom = "/home/admin/markw/portm/pmcom";

foreach $pm (@portmasters) {
open(PMCOM, "$Pmcom $pm 'show sess'|") || next;
undef(@ports);
while (<PMCOM>) {
if (!/^S/) { next; }
if (/IDLE/) {
($port, $junk) = split;
# print "Resetting $pm $port\n";
push(@ports, "$port");
# print RESET "reset $port";
}
}
close(PMCOM);
open(RESET, "|$Pmcom $pm -") || next;
foreach $port (@ports) {
print RESET "reset $port\n";
print "Reset $pm $port\n";
}
close(RESET);
}