Hello Guys
I have to run a perl script from unix one
The reason for this is I have to connect to remote server and then execute the perl script.
In unix script I am able to connect to remote server without any password via ssh
ssh -o 'PasswordAuthentication yes' -o 'PreferredAuthentications publickey' -i $HOME/.ssh/id_dsa
I dont know the eqivalent code in perl
so I am trying via unix script to connect the remote server and execute the perl script
My code is below
#!/usr/bin/ksh
ssh -o 'PasswordAuthentication yes' -o 'PreferredAuthentications publickey' -i $HOME/.ssh/id_dsa us320 <<EOF;
perl Balancing.pl m_SBD_GRD_0277_GP_VTL_PORT_CNTR_to_WRHS_STG;
if [$? = 0]
then
echo executed successfully;
else
exit
fi
EOF
Its result fine but getting warning like
stty: : No such device or address
So please let me know the equivalent remote connection in perl or how to avoid this warning
ssh -o 'PasswordAuthentication yes' -o 'PreferredAuthentications publickey' -i $HOME/.ssh/id_dsa "perl /Path/of/the/Perl/file/Balancing.pl m_SBD_GRD_0277_GP_VTL_PORT_CNTR_to_WRHS_STG"
1 Like
Or use the Net::SSH module to make the connection (requires publickey be set up, but you have that.)
1 Like
Thanks a lot to both of you but when I run
ssh -o 'PasswordAuthentication yes' -o 'PreferredAuthentications publickey' -i $HOME/.ssh/id_dsa us320 "perl Balancing.pl $1"
its giving
sqlplus not found
But the same when I run like this
ssh -o 'PasswordAuthentication yes' -o 'PreferredAuthentications publickey' -i $HOME/.ssh/id_dsa us320 <<EOF;
echo $1
perl Balancing.pl $1
its working fine
Please let me know how its so
In the first case, the Perl program is unable to "see" the environment variables of the remote server; in the second case it is.
tyler_durden
1 Like
Thanks Tyler ..
So is there any way to resolve the same?