Commands not working with ssh remote login

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

Unable to decipher and understand the logics, I still guess that you are using different users (monitor/user121) and hosts (tl04cp01/10.110.20.1).

Yes. users may differ. but, the script which my application is using is not executing with ssh and same is working with telent login

Are you aware that the environment may be seriously different for two users? That might be the reason for the logged error.

Hi,

I tried with same user, still getting same error. Do we need to enable any thing extra for ssh login?

For both logins, post the environment and the path to viewlog .

Thank you so much , it is working now.

How about posting your findings on what went wrong for the benefit of others in a similar situation?