Nohup Command gets status Stopped


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Nohup Command gets status Stopped
# 1  
Old 04-30-2015
Nohup Command gets status Stopped

Good Morning
I need your help please, i tried to execute this script using nohup command but it gets in status stopped

Code:
nohup ./SapInterfases.sh > SapInterfases.log &

prodstg02$ jobs
[1] + Stopped(SIGTTOU)            nohup ./SapInterfases.sh > SapInterfases.log &

I check out log:
Code:
$ more SapInterfases.log
Not a terminal

The goal is to execute each command sequentially and not to execute each command manually from the prompt shell
Those comamnds are sent out via Datastage jobs so logs are generaded by the application itself ?

Thanks for your help in advanced


Moderator's Comments:
Mod Comment
Please wrap all code, files, input & output/errors in CODE tags.
It makes them far easier to read and preserves spaces in case that is important.

Last edited by rbatte1; 04-30-2015 at 12:22 PM.. Reason: Added CODE tags and corrected spelling & case
# 2  
Old 04-30-2015
If you are planning to run them sequentially, why are they being put into the background, or does the script run your commands sequentially within it?

You may need to redirect your standard error to the file too like this:-
Code:
nohup ./SapInterfases.sh 2>&1 > SapInterfases.log &

The 2>&1 redirects standard error to standard output, which you then capture in a file.



Robin
# 3  
Old 04-30-2015
If the command attempts to read from the terminal while in the background, it will be stopped.

nohup does not and cannot prevent it from just reopening /dev/tty if it really wants to.

So, what is this script doing?
# 4  
Old 04-30-2015
The status shown:
Code:
nohup ./SapInterfases.sh > SapInterfases.log &

prodstg02$ jobs
[1] + Stopped(SIGTTOU)            nohup ./SapInterfases.sh > SapInterfases.log &

means that that job is stopped on terminal Output (i.e., writing to a terminal; not reading from a terminal). So Robin's suggestion might work.

If the script had been stopped when it tried to read from a terminal, the jobs output would have been:
Code:
[1] + Stopped(SIGTTIN)            nohup ./SapInterfases.sh > SapInterfases.log &

If Robin's suggestion doesn't work, as Corona688 said, we'll need to see the code to be able to help you figure out what the script is doing that causes it to be stopped.
# 5  
Old 04-30-2015
Quote:
Originally Posted by Don Cragun
The status shown:
Code:
nohup ./SapInterfases.sh > SapInterfases.log &

prodstg02$ jobs
[1] + Stopped(SIGTTOU)            nohup ./SapInterfases.sh > SapInterfases.log &

means that that job is stopped on terminal Output (i.e., writing to a terminal; not reading from a terminal). So Robin's suggestion might work.
Nohup ought to have done that already, no?
# 6  
Old 04-30-2015
Quote:
Originally Posted by Corona688
Nohup ought to have done that already, no?
With a POSIX-conforming nohup utility, yes. But, we haven't been told what OS and shell are being discussed in this thread. Many implementations of csh include (or at least used to include) a built-in nohup that does not meet POSIX requirements.
This User Gave Thanks to Don Cragun For This Post:
# 7  
Old 04-30-2015
Sorry i forgot to edit shell which is:
Code:
prodstg02$ more SapInterfases.sh
/archivos/Shells/SapInterfases.sh Ingl01 20150415 3 20150415
/archivos/Shells/SapInterfases.sh Ingl01 20150416 3 20150416
/archivos/Shells/SapInterfases.sh Ingl01 20150417 3 20150417
/archivos/Shells/SapInterfases.sh Ingl01 20150418 3 20150418

Every line takes about 3 hours, so thtats why i decided to put in a nohup to run in one run and not to take idle times to wait to finish and running the next execution manually

This is the information you asked before:

Code:
HP-UX prodstg02 B.11.31 U ia64 0787399713 unlimited-user license
prodstg02$ ps
   PID TTY       TIME COMMAND
 20275 pts/9     0:00 sh
 16671 pts/9     0:00 ps

Thanks for your hel in advanced
Moderator's Comments:
Mod Comment If you continue to refuse to properly format your posts, you will be banned from The UNIX & Linux Forums.

Last edited by Don Cragun; 04-30-2015 at 03:48 PM.. Reason: Add CODE tags.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with finding the exit status of a 'nohup' command using 'PID'.

Hello All, I need to run a set of scripts, say 50 of them, parallely. I'm running these 50 scripts, from inside a script with the help of 'nohup' command. 1.The fifty scripts are stored in a separate file. 2.In a master script, i'm reading every line of the file through loop and executing... (4 Replies)
Discussion started by: SriRamKrish
4 Replies

2. Solaris

Execute the ntpdate command only when NTP daemon is stopped?

Hi, Could somebody please explain me. why is it necessary to execute the "ntpdate" command only when ntp daemon is stopped , and also the probabale solution to reduce the high offset value. Thanks !! Laxxi (4 Replies)
Discussion started by: Laxxi
4 Replies

3. UNIX for Dummies Questions & Answers

Process status for NOHUP command

Hi, I have run a shell script as a background process using 'nohup' command. I want to see the process id of this, so that I will be able to kill it later on when required. I tried to collect these details using 'ps' command and could not view this information. How do we get this... (5 Replies)
Discussion started by: Dev_Dev
5 Replies

4. AIX

Nohup command

I'm trying to run a compress script in the background, but I even though the script is running in the background I get "Sending nohup output to nohup.out." and the screen just stays there. How can I make the script run in background and make my command prompt come back. I was using: nohup... (2 Replies)
Discussion started by: NycUnxer
2 Replies

5. Shell Programming and Scripting

Why the nohup-ed background process always is "stopped" ?

I let a script A call script B. I used nohup a.sh &>/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! -----Post Update----- BTW, if I don't use nohup... (4 Replies)
Discussion started by: meili100
4 Replies

6. UNIX for Advanced & Expert Users

Why the nohup-ed background process always is "stopped" ?

I let a script A call script B. I used nohup a.sh &>/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! -----Post Update----- BTW, if I don't use nohup... (1 Reply)
Discussion started by: meili100
1 Replies

7. UNIX for Dummies Questions & Answers

nohup command..

Hi.. Can anybody tell me, what exactly the nohup command does & when is it used? Your help is appreciated. (3 Replies)
Discussion started by: Amol21
3 Replies

8. UNIX for Dummies Questions & Answers

Problem with nohup command

Hello folks, I have got a script which telnets to different boxes and runs a certain script with 3 run time args. The line from the script which does it is: (sleep 1; echo $USERID ; sleep 1; echo $PASSWD ; sleep 1 ; echo y ; sleep 1 ; echo "\r" ; sleep 1 ; echo "cd $FILEPATH" ; sleep 1 ; sleep 1... (1 Reply)
Discussion started by: Rajat
1 Replies

9. Shell Programming and Scripting

What's the command for nohup in Oracle

Hello, I need running the process from Oracle in backround. Thank you for your help. C.Abarca (1 Reply)
Discussion started by: cabarcaj
1 Replies

10. UNIX for Dummies Questions & Answers

Nohup Command

Hello All, I am newbie to unix.I am trying to use NOHUP command in shell script it works fine with only "nohup test.sh 10 &" and "/opt/user/nohup test.sh 10 &" gives an error saying "ksh: /opt/user/nohup : not found". Can anybody please guide me to make it work. Thanks Blazix (9 Replies)
Discussion started by: blazix
9 Replies
Login or Register to Ask a Question