Operating System - HP-UX
1834394 Members
1456 Online
110066 Solutions
New Discussion

Remote Script Execution with SSH

 
SOLVED
Go to solution
John Carver
Frequent Advisor

Remote Script Execution with SSH

I am trying to execute a java startup script remotely using ssh. Below is the script on the local server.

#!/usr/bin/sh
#cuss.test

ssh -lconnecto typhoon /home/connecto/CUSSTest/startup.sh

exit


Here is the remote script that starts the java process.

#!/usr/bin/sh
#startup.sh

cd /home/connecto/CUSSTest

CLASSPATH=$CLASSPATH:/home/connecto/CUSSTest
export CLASSPATH

nohup /opt/java1.5/bin/java CUSocketServer &
echo $! > ss.pid

exit


The remote script starts the java process and exits cleanly but the script on the local host is still running tailing the contents of the nohup.out file from the remote host. The script will not finish unitil the java process on the remote host is stopped. What needs to be done to make the script on the local host work independent of the startup.sh script on the remote host?


cirrus /usr/cuscripts #./cuss.test
Using /home/connecto/CUSSTest/settings.xml for configuration...
2 REPLIES 2
Steven E. Protter
Exalted Contributor

Re: Remote Script Execution with SSH

Shalom,

Be default ssh does not read the complete environment on the target system. You will need to have your script read the profile and make sure the user environment on the remote system is the same as the local system.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
TwoProc
Honored Contributor
Solution

Re: Remote Script Execution with SSH

Try this, instead of:
ssh -lconnecto typhoon /home/connecto/CUSSTest/startup.sh

use:
ssh -lconnecto typhoon /home/connecto/CUSSTest/startup.sh > /dev/null 2>&1 &

if that doesn't work try:
ssh -lconnecto typhoon /home/connecto/CUSSTest/startup.sh > /dev/null 2>&1 - &
We are the people our parents warned us about --Jimmy Buffett