Re: need help SSH =(
Добавлено: 28 янв 2014, 08:53
У меня успешно заработал этот скрипт. Правда понадобились модули IO::Pty и Net::OpenSSH, но они успешно ставятся через cpan. Скрипт вышибло по таймауту, но ТД перезагрузилась.
Код: Выделить всё
#!/usr/bin/perl -w
use warnings;
use Net::OpenSSH;
my $ssh = Net::OpenSSH->new("192.168.0.5",
user => 'root',
password => 'root_password',
timeout => 60 );
my $output = $ssh->capture('reboot');
my $output = $ssh->capture({stdin_data => "reboot\n"});
$ssh->error and die "unable to run remote command: " . $ssh->error;