LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Why my script is always "stopped" ? (https://www.linuxquestions.org/questions/linux-software-2/why-my-script-is-always-stopped-728692/)

meili100 05-26-2009 04:39 PM

Why my script is always "stopped" ?
 
I let a script A call script B.
I used
Code:

nohup A &>/tmp/log &
In script A it calls B directly, without any redirecting or nohup or background.

However A is always "Stopped", while B is running correctly. Anybody knows why?
thanks!

stress_junkie 05-26-2009 06:56 PM

Is this homework from school?

Although you failed to include details the answer to your question appears to be trivially simple. You are not supposed to post homework questions.

meili100 05-26-2009 08:12 PM

My friend, this is not homework. I have been working on Linux for 2 years. This is the problem that drives me crazy.

Script A:
Code:

#do nothing but call B
ssh another-machine "/user/tom/b.sh"

Script B:
Code:

# do some fancy things, takes about 1 hour to finish
...

I used
Code:

nohup a.sh &>/tmp/log &
It was "stopped" after 5 minutes but B was running and B finished correctly.

Quote:

Originally Posted by stress_junkie (Post 3553731)
Is this homework from school?

Although you failed to include details the answer to your question appears to be trivially simple. You are not supposed to post homework questions.


meili100 05-26-2009 11:34 PM

BTW, if I don't use nohup and backgrounding, it's OK. i.e. if I use
Code:

a.sh
directly. Everything is OK. I am totally confused.

meili100 05-27-2009 02:25 PM

anybody has a clue?

colucix 05-27-2009 03:12 PM

The process in background loose connection with the standard input. Why you have to use nohup and background? And why you have to use a script to do that? Can't you simply do ssh remotehost, launch the script b.sh on the remote machine (using nohup and background), then disconnect and go home? Or eventually use screen to detach the process and reconnect later to check the output.

meili100 05-28-2009 12:30 AM

Thanks lot. Script A is a wrapper. It also does other misc things, like logging.

You mentioned the process in background loose connection with STDIN, whose STDIN? Would you elaborate more? Thanks again.

Quote:

Originally Posted by colucix (Post 3554692)
The process in background loose connection with the standard input. Why you have to use nohup and background? And why you have to use a script to do that? Can't you simply do ssh remotehost, launch the script b.sh on the remote machine (using nohup and background), then disconnect and go home? Or eventually use screen to detach the process and reconnect later to check the output.


colucix 05-28-2009 02:31 AM

Does the script a.sh expect something from standard input? For example, the password for the ssh connection? If you put the script in background, it is detached from the terminal and you cannot send input to the script, if required. In that case the script stop its execution, waiting for something that can't be fed.


All times are GMT -5. The time now is 04:35 PM.