[EMAIL PROTECTED] wrote: > > ive got a simple sh script that pings machines on my network segment. > > very new to perl, could folx on the list give me some hints/pointers to how > to make this shell > script into a perl one? > > !/usr/bin/sh > SERVERS="itsux17 its29 itsux24 int-dns1 int-dns2 mrtg defgtway" > for S in $SERVERS > do > PING1=`/etc/ping $S 32 -n 6 | grep trans | awk '{print $7}' | cut > -d"%" -f1` > if [ $PING1 -gt 25 ]; then > if [ $PING1 -gt 99 ]; then > mailx -s "CRITICAL: $PING1 % errors on $S Server may be > down" [EMAIL PROTECTED] > else > mailx -s "WARNING: $PING1 % errors on $S" > [EMAIL PROTECTED] > fi > fi > done > exit
#!/usr/bin/perl @SERVERS = qw(itsux17 its29 itsux24 int-dns1 int-dns2 mrtg defgtway); for $S ( @SERVERS ) { for ( `/etc/ping $S 32 -n 6` ) { if ( /trans/ ) { ( $PING1 = $_ ) =~ s/\D+//g; } } if ( $PING1 > 25 ) { if ( $PING1 > 99 ) { system qq(mailx -s "CRITICAL: $PING1 % errors on $S Server may be down" [EMAIL PROTECTED]); } else { system qq(mailx -s "WARNING: $PING1 % errors on $S" [EMAIL PROTECTED]); } } } exit John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]