I've been wondering about this for a while and I just don't know where to start looking. Some of my scripts always get stopped when I start them with
in the shell (bash, on Debian lenny, logged in via ssh from a Mac OS machine using Terminal.app). After a few seconds I keep on getting
If I do "fg" it goes on running, but I have to open another shell to work in until it's done. Not a "problem", but annoying. The particular script I'm working on at the moment (this may have nothing to do with it, I don't know) opens a bunch of windows on an X desktop using VNC, but I don't really care what happens there (I don't work directly in an xterm in the VNC window for speed issues and because there is a long standing keyboard mapping bug involving VNC and Gnome).
The problem is just so general it's difficult to google ("script stopped shell"???) :-/ If anyone can help me guess where to start, it would be really great. Thanks!
Try to send it into background instead of fg:
That's how I send into background running jobs, to reclaim my terminal prompt in bash: ctrl+z stops the job, and then bg will send it running but in background.
You can also use
to background job number 1, which you can read from here:
What puzzles me is that running it with & should run it in the bg.
A background job that tries to read from its teriminal is sent a signal which suspends it (SIGTTIN). The same may happen when trying to write to the terminal (SIGTTOU), but that depends on terminal settings (tostop).
If that job requires some input, if it is known ahead of time what it needs, you can redirect it. If it's trying to write to stdout or stderr, you may need to redirect those (or fiddle with your terminal's settings, if an attempt to write is the problem).
You probably want to use nohup. Not only will it redirect all the standard file streams, but it will ensure that your script will survive should the terminal go away and cause the shell to send SIGHUP to its jobs.
Sorry for being unresponsive - I'm still working on that script :-/
Quote:
Originally Posted by mirni
Try to send it into background instead of fg:
When I do that, it gets stopped again after a few seconds :-/
Quote:
Originally Posted by mirni
So, what shell are you using? On what platform?
I use bash, on Debian lenny, logged in via ssh from a Mac OS X machine using Terminal.app
---------- Post updated at 06:27 AM ---------- Previous update was at 06:22 AM ----------
Quote:
Originally Posted by alister
A background job that tries to read from its teriminal is sent a signal which suspends it (SIGTTIN). The same may happen when trying to write to the terminal (SIGTTOU), but that depends on terminal settings (tostop).
If that job requires some input, if it is known ahead of time what it needs, you can redirect it. If it's trying to write to stdout or stderr, you may need to redirect those (or fiddle with your terminal's settings, if an attempt to write is the problem).
You probably want to use nohup. Not only will it redirect all the standard file streams, but it will ensure that your script will survive should the terminal go away and cause the shell to send SIGHUP to its jobs.
Regards,
Alister
Thanks for the ideas. I just wanted to stay I'm still working on that script and investigating what the problem might be. I've used nohup in the past and I can't remember whether there were problems with that too or not.
Hi,
I want to run a shell script in background .
but its going to stopped state
$ ksh cat_Duplicate_Records_Removal.ksh &
8975
$
+ Stopped (tty output) ksh cat_Duplicate_Records_Removal.ksh &
why is this happening?
Also could anyone please tell me what is a stopped... (12 Replies)
I have created a shell scrit to run the informatica workflows sequentially.In the script i am executing 7 workflows sequentially after running 4 workflows the scrpt getting stop and it is not continuing next step evn it is updating logs.4th workflow will take more time to finish is that making... (1 Reply)
Hello gurus,
I have three korn shell script 3.1, 3.2, 3.3. I would like to call three shell script in one shell script.
i m looking for something like this
call 3.1;
If 3.1 = "complete" then
call 3.2;
if 3.2 = ''COMPlete" then
call 3.3;
else
exit
The... (1 Reply)
Hi,
Probably a real easy one for someone...I need to have a scheduled cp job run from crontab to copy certain files and directories to a shared NFS storage.
The script I have works fine, except I need to exclude certain directories to stop issues with symbolic links, can someone explain... (2 Replies)
I have a text file . Format of text file.
djss:xd:78:isdev:"test server"
this type of row. (approx 30).
I want to display like that
1. djjs@msxd testserver 2. xjfd@msxd devserver
3. 4
select any one from above choice : 1... (5 Replies)
if I run the below mentioned code, i am getting error. I dunno why. plz help me out this code runs a sql query and sends the result by email
#!/bin/ksh
#
# Purpose: - Report Workflows that have Persistence turned ON
echo "Workflow Persistence Report Started: `date '+%Y%m%d_%H%M%S'`" >>... (6 Replies)
Hi, I am not experienced in shell scripts, I hope someone can give some hint for the following problem
I have html file like this
<html>
<body>
Some stuff
More stuff
<pre>
A
B
</pre>
Still more stuff
And more
<pre>
C
D
</pre>
Additional stuff
</body> (2 Replies)
Hi,
i have made a script which makes some analyses on some differnet hosts.
but i have a problem to make this script more quicker ...
i would like to enter more a one hosts in the query
(in my script are this:
Pls enter the Hostname ...
read hostname
for i in $hostname
do
echo... (5 Replies)