10 use lib "$FindBin::Bin/../lib";
14 my ($status, $cmd, @output);
17 usage => sub { podusage() } ,
18 hostname => $ENV{HOST} || 'localhost',
19 username => $ENV{USERNAME} ? $ENV{USERNAME} : $ENV{USER},
20 password => $ENV{PASSWORD},
35 $opts{command} = join ' ', @ARGV;
38 print "Attempting to connect to $opts{username}\@$opts{hostname} to execute \"$opts{command}\"\n";
40 my $remote = Rexec->new (
41 host => $opts{hostname},
42 username => $opts{username},
43 password => $opts{password},
47 print "Connected to $opts{username}\@$opts{hostname} using "
48 . $remote->{protocol} . " protocol\n";
50 print "Executing command \"$opts{command}\" on $opts{hostname} as $opts{username}\n";
51 @output = $remote->execute ($opts{command});
52 $status = $remote->status;
54 print "\"$opts{command}\" status: $status\n";
57 print "No lines of output received!\n";
59 print "$_\n" foreach (@output);
62 print "Unable to connect to $opts{username}\@$opts{hostname}\n";