LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-26-2009, 04:39 PM   #1
meili100
LQ Newbie
 
Registered: Oct 2007
Posts: 25

Rep: Reputation: 15
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!
 
Old 05-26-2009, 06:56 PM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
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.
 
Old 05-26-2009, 08:12 PM   #3
meili100
LQ Newbie
 
Registered: Oct 2007
Posts: 25

Original Poster
Rep: Reputation: 15
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 View Post
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.

Last edited by meili100; 05-26-2009 at 08:18 PM.
 
Old 05-26-2009, 11:34 PM   #4
meili100
LQ Newbie
 
Registered: Oct 2007
Posts: 25

Original Poster
Rep: Reputation: 15
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.
 
Old 05-27-2009, 02:25 PM   #5
meili100
LQ Newbie
 
Registered: Oct 2007
Posts: 25

Original Poster
Rep: Reputation: 15
anybody has a clue?
 
Old 05-27-2009, 03:12 PM   #6
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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.
 
Old 05-28-2009, 12:30 AM   #7
meili100
LQ Newbie
 
Registered: Oct 2007
Posts: 25

Original Poster
Rep: Reputation: 15
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 View Post
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.
 
Old 05-28-2009, 02:31 AM   #8
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 7 12-19-2015 01:03 AM
"TOP" Command keeps going to "stopped" state mudtoe Linux - Newbie 3 03-09-2009 11:15 PM
Execution of a script to be stopped after "x" minutes of time YSE Linux - Newbie 3 10-01-2008 12:00 AM
Can't install "glibmm" library. "configure" script can't find "sigc++-2.0&q kornerr Linux - General 4 05-10-2005 02:32 PM
Monthly Archiving Script... help with "date" & "cron" Supp0rtLinux Linux - Software 3 01-03-2003 09:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration