Operating System - HP-UX
1819903 Members
1877 Online
109607 Solutions
New Discussion юеВ

Re: ssh hanging with nohup

 
SOLVED
Go to solution
ANDRE David
Occasional Advisor

ssh hanging with nohup

Hi,

I use ssh.
When i try to execute a script shell with nohup 'command' &, the ssh is hanging.
( it seem waiting the end of process )

I tried nohup sleep 10 &
the ssh is terminated after 10 sec.

How can i detach a process with nohup and ssh ?
regards.
5 REPLIES 5
RAC_1
Honored Contributor

Re: ssh hanging with nohup

Can you post the script?

In your script what exactly you do?
Something like -- ssh host "command"

Anil
There is no substitute to HARDWORK
ANDRE David
Occasional Advisor

Re: ssh hanging with nohup

hello,

the command is :

ssh -l i2admin b5ora2 /I2/Test/test.sh

on test.sh, i have :
nohup sleep.sh &

on sleep.sh i have
sleep 10

The ssh is waiting the end of sleep.sh

So, i have the solution :

on sleep.sh :
sleep 10 < /dev/null > /dev/null 2>&1 &

--> ssh is terminated immediatly.

Thanks.
RAC_1
Honored Contributor

Re: ssh hanging with nohup

ssh -l i2admin b5ora2 /I2/Test/test.sh

With that you should get command prompt after test.sh ends. (after 1- sec) Is that the case?

Anil
There is no substitute to HARDWORK
ANDRE David
Occasional Advisor

Re: ssh hanging with nohup

yes now, it is the case.

before the modification on sleep.sh (append the follow < /dev/null > /dev/null 2>&1 & )
i received the command prompt after 10 seconds.

Now, i receive the command prompt immediatly.

RAC_1
Honored Contributor
Solution

Re: ssh hanging with nohup

So that is it. With the use of /dev/null you will get prompt immediately and if you put sleep 10, you will get prompt, after 10 sec.

Anil
There is no substitute to HARDWORK