- or download this
use warnings;
use strict;
...
print $line;
exit 0 if $line =~ /SSH/;
exit 1;
- or download this
$ perl sshping.pl localhost; echo $?
Connecting to port 22...
Connected.
SSH-1.99-OpenSSH_x.xx Debian-xxx
0
- or download this
$ perl sshping.pl localhost; echo $?
Connecting to port 22...
connect() failed: Connection refused at sshping.pl line 14.
111
- or download this
$ if perl sshping.pl localhost; then echo up; else echo down; fi
Connecting to port 22...
connect() failed: Connection refused at sshping.pl line 14.
down