Hi Friends,
I am unable to run our application commands on remote server using ssh (passwordless login enabled). But the same command running with telent perl script. please suggest.
SSH:
C:/bin>ssh -l monitor tl04cp01 exec "/home/monitor/123"
/home/monitor/123[2]: viewlog: not found.
Telnet: (perl)
C:/bin>cat test.pl <---- (perl script to login with telnet)
#! /usr/bin/perl -w
use Net::Telnet ();
$hostname = "$ARGV[0]";
$username = "$ARGV[1]";
$password = "$ARGV[2]";
$t = new Net::Telnet ( Timeout=>20, Errmode=>'die');
$t->open("$hostname");
$t->login("$username","$password");
@alarm = $t->cmd("/home/monitor/123");
print @alarm;
Successfully executed:
C:/bin>./test.pl 10.110.200.1 user121 'xxxxxx'
PAGE: 1
Measurements date: Jun 23, 2016 Generation date: Jun 24, 2016
Measurements time: 00:00-24:00 IST Generation time: 00:02:36 IST