nohup in ksh

nohup in ksh

Post by Kin-Lin PO » Sat, 16 Mar 1996 04:00:00



I would like to set the korn shell environment such that any
background application will be immune to the kill signal even
after logout.  But I don't want to type nohup before the command
everytime.  How may I achieve this?

--

                 852.252.56.531

 
 
 

nohup in ksh

Post by Brian S Hile » Wed, 20 Mar 1996 04:00:00


: I would like to set the korn shell environment such that any
: background application will be immune to the kill signal even
: after logout.  But I don't want to type nohup before the command
: everytime.  How may I achieve this?

First thought was to write an alias, but _any_ application? Not an option.

(1)     In ksh93: "nohup" the entire shell, with its background process
        group. (untested)

disown $$

(2)     Try writing a custom shell, that merely takes arguments, and "nohup"s
        the resulting user executions:
        Of course, this is an extremely rudimentary example.

while true
do      read -r REPLY\?"${PS1:-$ }"
        eval "nohup $REPLY"
done

(3)     write to a nohup'ed ksh process in the background via a coprocess.
        (minimally tested)

$ nohup ksh -s |&
$ print -p 'print hello world'
$ read -p
$ print -r -- "$REPLY"
hello world

Experiment! (And then tell comp.unix.shell how you did it.)

-Brian
--
   ,---.     ,---.     ,---.     ,---.     ,---.     ,---.     ,---.  
  /  _  \   /  _  \   /  _  \   /  _  \   /  _  \   /  _  \   /  _  \  

__,'   `.___,'   `.___,'   `.___,'   `.___,'   `.___,'   `.___,'   `.__

 
 
 

nohup in ksh

Post by Michael Zawrot » Thu, 21 Mar 1996 04:00:00





>: I would like to set the korn shell environment such that any
>: background application will be immune to the kill signal even
>: after logout.  But I don't want to type nohup before the command
>: everytime.  How may I achieve this?

>First thought was to write an alias, but _any_ application? Not an option.

>(1) In ksh93: "nohup" the entire shell, with its background process
>    group. (untested)
 [snip]
>(3) write to a nohup'ed ksh process in the background via a coprocess.
>    (minimally tested)

>$ nohup ksh -s |&
>$ print -p 'print hello world'
>$ read -p
>$ print -r -- "$REPLY"
>hello world

>Experiment! (And then tell comp.unix.shell how you did it.)

The easy way to do it is to put the line:
  trap "" HUP
in your .kshrc file (or wherever your ENV variable points to.  All of the
sub-processes you spawn will inherit the trap and therefore ignore the
SIGHUP send when you logout.  At least it works for me anyway.  You will
still get the "you have background jobs" running message when you try to
logout.  If I remember correctly, I got this from the O'Reilly book
"Learning the Korn Shell", $28 at Borders and well worth the money.

Mike
--
Dr. Michael Zawrotny
UMBC Dept of Chemistry and Biochemistry  

Baltimore, MD 21228                     | phone:  (410) 455-2718

 
 
 

nohup in ksh

Post by John L. All » Sat, 23 Mar 1996 04:00:00





>: I would like to set the korn shell environment such that any
>: background application will be immune to the kill signal even
>: after logout.  But I don't want to type nohup before the command
>: everytime.  How may I achieve this?

>First thought was to write an alias, but _any_ application? Not an option.

>(1) In ksh93: "nohup" the entire shell, with its background process
>    group. (untested)

>disown $$

>(2) Try writing a custom shell, that merely takes arguments, and "nohup"s
>    the resulting user executions:
>    Of course, this is an extremely rudimentary example.

Must it be so complicated?  Why not just do a trap '' HUP
in the parent shell.

John.

<blank lines to appease my newsreader>

 
 
 

nohup in ksh

Post by Bill Zissimopoulo » Thu, 28 Mar 1996 04:00:00




> : I would like to set the korn shell environment such that any
> : background application will be immune to the kill signal even
> : after logout.  But I don't want to type nohup before the command
> : everytime.  How may I achieve this?

[some suggestions snipped]

Quote:> (3)     write to a nohup'ed ksh process in the background via a coprocess.
>         (minimally tested)

> $ nohup ksh -s |&
> $ print -p 'print hello world'
> $ read -p
> $ print -r -- "$REPLY"
> hello world

> Experiment! (And then tell comp.unix.shell how you did it.)

> -Brian

Since all nohup does is ignore the hangup signal why not just
        trap "" 1

I think this should do it. Of course at this time (4:30 in the morning),
after writting about 600 lines of C for Windows I can't be sure about many
things.

Bill
--

http://www-dept.cs.ucl.ac.uk/students/B.Zissimopoulos/

 
 
 

1. nohup (script1.ksh ; script2.ksh ) & doesn't work

hi,

I am trying to start 2 processes , one after the other but
nohup (script1.ksh ; script2.ksh ) &  doesn't work.

man nohup indicates that It should work and I know how to bypass this
problem , I am just wondering why it doesn't work.

thanks
Michael

2. booting off floppy under Solaris 2.1

3. What's 'side effects' of Ksh built-ins?

4. color coded `ls' output

5. Nohup doesn't work as I need with ksh on Solaris 2.6

6. booting 2.0.0 over umsdos

7. ksh, nohup, and background processes

8. .so thingies!

9. nohup and ksh

10. nohup, ksh, & serial line hangs

11. nohup and ksh

12. nohup in ksh