T.R | Title | User | Personal Name | Date | Lines |
---|
10017.1 | close stdout/stderr | SAPEC3::WALLMEROTH | | Tue Jun 03 1997 05:50 | 11 |
| This is because the stdout/stderr remain open as long as the script
is running.
Try to redirect stdout and/or stderr indide your script; eg:
#!/bin/ksh
exec >/path/file/stdout 2>/path/file/stderr
If you don't need the output, you may even close them:
#!/bin/ksh
exec >&- 2>&-
Eckhardt
|
10017.2 | didn't work | CSC32::HEINZ | | Tue Jun 03 1997 12:47 | 22 |
| no go,
on sysa i have a ksh script "/tmp/sleep"
--------------------
#!/bin/ksh
/usr/ucb/sleep 1200 >/dev/null 2>&1
---------------------
on sysb i enter (rsh sysa "/tmp/sleep &")
i will not get the prompt back on sysb until the sleep completes.
i also tried the -n option.
i don't even know if this is supposed to work but the customer
wants me to escalate because it works for her to an ncr system.
royal
|
10017.3 | Maybe this will work? | RHETT::PARKER | | Tue Jun 03 1997 13:18 | 19 |
|
Hi, Royal.
If I change the script to look like:
#!/bin/ksh
/usr/ucb/sleep 1200 >/dev/null 2>&1 &
Then do the rsh, I get my prompt back. The sleep continues
until it's done without a controlling terminal :
4500 ?? S 0:00.01 /usr/ucb/sleep 1200
I didn't read .0 so I don't know if this is what you are trying
to do...
Hth,
Lee
|
10017.4 | don't alter my hints | SAPEC3::WALLMEROTH | | Thu Jun 05 1997 05:59 | 14 |
| re .1
Your script:
#!/bin/ksh
/usr/ucb/sleep 30 >/dev/null 2>&1
Doesndoesn't do what I told you.
#!/bin/ksh
exec >/dev/null 2>&1
/usr/ucb/sleep 1200
will do it. In your version the /bin/ksh, which is waiting for the
sleep to end, has its stdout/stderr still open.
Eckhardt
|
10017.5 | Still no go w/o & | RHETT::PARKER | | Thu Jun 05 1997 10:31 | 16 |
|
Hi, Eckhardt.
That still does not work unless you put the call to sleep in
the background like I showed in .3. Did you try it? I did.
The 2>&1 in .3 merges stderr w/ stdout but does not put the
job in the background. I have since read .0 and this should be
an acceptable work-around. The program they are using will need
to take care to log any errors to a file since there is no controlling
terminal but that must be how it works on the NCR machine too...
Hth,
Lee
|
10017.6 | one or two & ? | SAPEC3::WALLMEROTH | | Thu Jun 05 1997 11:51 | 13 |
| re .5
hello Lee,
yes I tested it with the example given in .2
.2 has the ampersand in its rsh call:
(rsh sysa "/tmp/sleep &")
and ONE ampersand should be enough.
Do you really need two of them ???
btw: my re.4 was meant as reply to re.2; I erronously wrote 're .1'
Eckhardt
|
10017.7 | Ok, but... | RHETT::PARKER | | Thu Jun 05 1997 12:30 | 40 |
|
Hi, Eckhardt.
Well, I don't see the purpose of doing
(rsh sysa "/tmp/sleep &")
Here's what happens for me :
cat /tmp/junk2
#!/bin/ksh
exec >/dev/null 2>&1
/usr/ucb/sleep 1200
w/o the & after 1200, here is what I get :
rsh sysa /tmp/junk2 &
[1] + Suspended (tty input)rsh karp3 /tmp/junk2
ps(1) shows the jobs stopped:
18863 ttyp4 T 0:00.00 rsh karp3 /tmp/junk2
Now, if I place the & after the 1200 and use the & on the rsh line,
[1] + Suspended (tty input)rsh karp3 /tmp/junk2
I do fg %1 and just get my prompt back. But, the sleep is still
running on sysa :
769 ?? S 0:00.01 /usr/ucb/sleep 1200
So, if you don't put the & on the rsh line, you will get your
prompt back in a few seconds and the sleep will continue on sysa.
Hth,
Lee
|
10017.8 | quote "" it !!! | SAPEC3::WALLMEROTH | | Thu Jun 05 1997 13:39 | 17 |
| re .7
Hi Lee,
you should try to use:
rsh sysa "/tmp/junk2 &"
The quotes are important, without them you put your rsh into background
with them the shell started on the remote side puts the command
/tmp/junk2 into background and that is what .1/.2 wanted to do.
Putting rsh into background without using the -n flag, will stop the
rsh immediatly in every shell with job-control.
The fact, that the sleep continues to run is what we want to see.
OK ?
Eckhardt
|
10017.9 | OK | RHETT::PARKER | | Thu Jun 05 1997 13:52 | 12 |
|
Hi, Eckhardt.
Ok, that works just fine. I missed the quotes. What I put in
.3 also works fine.
Wonder what happened to Royal, the poster of .0 ?
Thanks,
Lee
|