#!/usr/bin/perl -w my $result; my $sshprog="/usr/bin/ssh"; my $sshhost="192.168.2.3"; my $sshuser="root"; my $cmd1="ps -ef | grep -v grep |grep fwd"; my $cmd2="ifconfig eth0 down"; $result=`$sshprog $sshuser\@$sshhost $cmd1 2>&1`; if ($? == 0) { print "Firewall Dameon is running\n"; exit 0 } # end if ($? != 0) if ($? != 0) { print "Firewall Dameon is not running. Bringing down the interfaces\n"; $result=`$sshprog $sshuser\@$sshhost\ $cmd2 2>&1`; exit 0 } # end if ($result != 0)