Skip to content

Instantly share code, notes, and snippets.

@nickanderson
Created July 14, 2010 16:35
Show Gist options
  • Save nickanderson/475648 to your computer and use it in GitHub Desktop.
Save nickanderson/475648 to your computer and use it in GitHub Desktop.
my $cmd;
@ssh_keys = ("$ENV{HOME}/.ssh/zenoss",
"$ENV{HOME}/.ssh/nss_restart",
"$ENV{HOME}/.ssh/id_rsa",
"$ENV{HOME}/.ssh/id_dsa",
"$ENV{HOME}/.ssh/identity",);
my $ssh = Net::SSH::Perl->new($host, identity_files => @ssh_keys);
$ssh->login($user, $pass);
#### cd command doesn't work remotely, run command from /
#$cmd = "/usr/local/netscape/server4/$service/stop";
$cmd = "echo hi host: $host service: $service";
my($stdout, $stderr, $exit) = $ssh->cmd($cmd);
print "$stdout";
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment