Operating System - HP-UX
1847212 Members
2449 Online
110263 Solutions
New Discussion

Re: Problem starting application remotely via SSH

 
SOLVED
Go to solution
Raynald Boucher
Super Advisor

Problem starting application remotely via SSH

Hello all,
I'm having a little problem starting Remedy (Action Request System) remotely.

The command server runs HP-UX 11.11
The target server runs Linux 2.4.22-28

We run a script on the HP-UX server to bounce the application.
"ssh root@target '/etc/rc.d/init.d/remedy stop'" works perfectly.

"ssh root@target '/etc/rc.d/init.d/remedy start'" starts the application OK but never returns to the issuing script. It just hangs preventing the script from completing.

Any clues?

RayB
9 REPLIES 9
Dennis Handly
Acclaimed Contributor
Solution

Re: Problem starting application remotely via SSH

>It just hangs preventing the script from completing.

Have you redirected stdin to /dev/null, with -n?
Raynald Boucher
Super Advisor

Re: Problem starting application remotely via SSH

hello Dennis,

Nope, that is the command exactly as issued.

I'm told you can notice the command on the target server using "ps".
The issuing script continues after you kill the process on the target server.
Almost looks like it's waiting for a confirmation (something like do you want to continue?) but only when triggered remotely.

Strange

Rayb
Dennis Handly
Acclaimed Contributor

Re: Problem starting application remotely via SSH

>Nope, that is the command exactly as issued.

The suggestion was to add -n and see if it now works.
Bill Hassell
Honored Contributor

Re: Problem starting application remotely via SSH

Have you tried this command on the Linux box? It may have been badly written and never returns. Many start/stop scripts have problems that the rc process can hide. If it hangs locally, someone forgot to put the startup steps into the background or start the process as a daemon. You can probably get around this error by putting the ssh command line into the background:

ssh root@target 'nohup /etc/rc.d/init.d/remedy start &'

But I would get the error in the start/stop script fixed.


Bill Hassell, sysadmin
Raynald Boucher
Super Advisor

Re: Problem starting application remotely via SSH

Hello Bill,
The startup script on the Linux box has been in use for years and works well both from the command line and from a script (ex nightly backup).
The problem occurs when running it remotely.

I was wondering if it couldn't be something to do with the login process where "ssh root@target" sets up an interactive shell as opposed to "ssh root@target script" does not. There might be a switch or variable that needs to be set or a profile that needs to be run???

The startup script also does an su to another user to start/stop the application.

RayB
Bill Hassell
Honored Contributor

Re: Problem starting application remotely via SSH

ssh will not setup a non-interactive session unless you tell to do so, as Dennis has suggested. And just to make sure, add the stdin redirect to your command line, like this:

"ssh -n root@target '/etc/rc.d/init.d/remedy start < /dev/null'


Bill Hassell, sysadmin
Steven E. Protter
Exalted Contributor

Re: Problem starting application remotely via SSH

Shalom,

Try ssh -X
ssh -Y to hpux hosts.

Make sure the firewall on the linux box permits port 22.

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
Patrick Wallek
Honored Contributor

Re: Problem starting application remotely via SSH

>>Try ssh -X
>>ssh -Y to hpux hosts.

I don't see what good that would do. The '-X' and '-Y' options are for X11 forwarding. That would hardly seem to apply here.
Armin Kunaschik
Esteemed Contributor

Re: Problem starting application remotely via SSH

Try ssh -n (as described above).
Sometimes it also advisable to use "-o BatchMode=yes"
Usage of X11 Forwarding does not make sense here.
When -n and Batchmode are not enough consider nohup in background like
ssh root@target 'nohup /etc/rc.d/init.d/remedy start >/wherever/startuplog 2>&1 &'

My 2 cents,
Armin
And now for something completely different...