[comp.unix.aux] nohup and ksh

jim@jagubox.gsfc.nasa.gov (Jim Jagielski) (11/20/90)

I use the Korn shell (ksh) all the time. I like it alot. However, as you
other "Korners" out there may know, nohup does NOT like ksh and will kill
your background process if you log off even if you proceed it with "nohup".

Well, to give Korn nohup capability, I've written a VERY simple, basic
shell script version of nohup for ksh... I call it knohup :)

It's available via anon-ftp on jagubox... 
--
=======================================================================
#include <std/disclaimer.h>
                                 =:^)
           Jim Jagielski                    NASA/GSFC, Code 711.1
     jim@jagubox.gsfc.nasa.gov               Greenbelt, MD 20771

"Kilimanjaro is a pretty tricky climb. Most of it's up, until you reach
 the very, very top, and then it tends to slope away rather sharply."

thad@cup.portal.com (Thad P Floryan) (11/22/90)

jim@jagubox.gsfc.nasa.gov (Jim Jagielski) in <3955@dftsrv.gsfc.nasa.gov>
writes:

	I use the Korn shell (ksh) all the time. I like it alot. However, as
	you other "Korners" out there may know, nohup does NOT like ksh and
	will kill your background process if you log off even if you proceed
	it with "nohup".

Not one to defend software I didn't write, I was incredulous at Jim's comment
(above); I simply didn't believe it.  And I still don't.

Did you remember to append an "&" on the command line per the following
example (you MUST have, else why the comment "background process"?):

	ksh> nophup  command  &

In any event, I just tried the command form "nohup command &" on four systems
I could access from home (two HP-UX (3.* and 7.*), one Amdahl UTS, and one 3B1)
using the "stock" ksh and nohup suppplied with each system and they all worked
fine, so the problem might be specific to A/UX; I'll try it out on some other
systems and on both A/UX 2.0 and 1.* when I get to my office later today.

Sheesh, if it IS a problem with A/UX, then I've problems, since I need that
capability; will check out Jim's workaround since I just checked the AT&T
ToolChest and the price for the sources to ksh 88e is $3,000.  Anyone brought
up "bash" on A/UX yet?

This is getting ridiculous: to get my job done, I've had to replace MAJOR (to
me) A/UX components since the cc and make supplied with A/UX simply cannot
handle the tasks I needed performed (am now using the GNU gcc and make).  And
I finally located a version of "curses" that is at least compatible with
SVR3.2 ... in the IBM PC marketplace of all places (from Aspen Scientific).

Sheesh.  If it wasn't for several customers asking for my product on A/UX, I
wouldn't be using this platform; I already have SVR3.2.2 and SVR4 "boxes"
available to me for my major port to 680x0 platforms (I singled the CPU out
because I also have a code-generator in the product).

Thad Floryan [ thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ]

alexis@panix.uucp (Alexis Rosen) (11/26/90)

Like Thad, I can't check this out at this moment, but I wouldn't be very
surprised if Jim was right. (It would be pretty hard to screw up on something
this simple...)

However, for those of you (like Thad) looking at ksh source licenses, consider
waiting another couple of months. Apple will be including this much-improved,
bug-fixed ksh (1988) in A/UX 2.0.1. If this bug is for real, I'm sure it will
be squashed there.

---
Alexis Rosen
Owner/Sysadmin, PANIX Public Access Unix, NY
{cmcl2,apple}!panix!alexis

jim@jagubox.gsfc.nasa.gov (Jim Jagielski) (11/26/90)

In article <36130@cup.portal.com> thad@cup.portal.com (Thad P Floryan) writes:
>jim@jagubox.gsfc.nasa.gov (Jim Jagielski) in <3955@dftsrv.gsfc.nasa.gov>
>writes:
>
>	I use the Korn shell (ksh) all the time. I like it alot. However, as
>	you other "Korners" out there may know, nohup does NOT like ksh and
>	will kill your background process if you log off even if you proceed
>	it with "nohup".
>
>Not one to defend software I didn't write, I was incredulous at Jim's comment
>(above); I simply didn't believe it.  And I still don't.

believe it... see below.

>
>Did you remember to append an "&" on the command line per the following
>example (you MUST have, else why the comment "background process"?):
>
>	ksh> nophup  command  &
>

Actually, the effect of "stopping" the background process has been removed
(as far as I can tell) from A/UX 2.0. nohup on 1.1 (and 1.1.1 I guess) did
NOT trap the HUP signal for ksh so if you were running something in the back-
ground under ksh and logged off, the background process WOULD die when it 
received the HUP signal... This WAS documented in the manuals. As I understand
csh (I don't use it), the & automatically traps HUP and makes the process nice.

As far as 2.0 is concerned, it looks like nohup just doesn't know how to
use ksh-specific features... for example "nohup alias &" will crash and burn.
If the command is not ksh-specific (like ls or whatever) then it'll work fine.
It may also work this way with csh, but I don't use it and don't know...

The man page for nohup does state that it's only works with sh and csh.

--
=======================================================================
#include <std/disclaimer.h>
                                 =:^)
           Jim Jagielski                    NASA/GSFC, Code 711.1
     jim@jagubox.gsfc.nasa.gov               Greenbelt, MD 20771

"Kilimanjaro is a pretty tricky climb. Most of it's up, until you reach
 the very, very top, and then it tends to slope away rather sharply."