#!/usr/bin/perl use Net::SSH qw(sshopen2); use strict; my $user = "jdrury"; my $host = "192.168.2.3"; my $cmd = "ps -ef | grep -v grep |grep fwd"; sshopen2("$user\@$host", *READER, *WRITER, $cmd) || die "ssh: $!"; # Example from README # # while () { # chomp(); # print "$_\n"; # } if ($cmd) { print "FWD is running\n"; } else { print "FWD is not running!!\n"; } close(READER); close(WRITER);