Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: nohup dies



"Pau Amaro-Seoane" wrote:
> I have been using zsh for a while and I like it a lot. Yet, today I
> ran into a snag...

There are various issues here...

> The problem? nohup dies in zsh 4.3.2

nohup is not a shell builtin; it's simply an executable programme that's
run by the shell and that in turn runs the command line passed as
arguments.

> Today I closed the ssh session with exit and then exit again after the
> message and got this:
> 
> zsh: you have running jobs.
> tuffi1| exit
> zsh: warning: 1 jobs SIGHUPed
> [1]  + 18591 done       nohup cat ./input |
>        18592 hangup     ~pau/executables/NB4_NoPN > diagnostic

The pipeline is forked before the nohup is executed.  In more detail.

  zsh creates a pipeline
  zsh forks:
     In the subshell, "nohup cat ./input" is run
  zsh forks again
     In the new subshell, ~pau/executables/... is run

So the "nohup" doesn't cover the second executable.

> When I used the cluster in my former institute everything went fine,
> and there they have zsh 4.2.4

Is it possible the option "setopt nohup" was in effect there?  This has
the same effect as "nohup" for all background commands.  (It's not
*quite* the same; the command nohup protects the following command line
from the signal, while the option stops the shell sending the signal
when it exits.)

> I changed the shell to ksh and the simulations (i.e. nohup) are not
> killed when I quit the session...

A lot of other shells, I presume (but I haven't actually checked)
including ksh, don't send SIGHUP to processes when the shell exits.

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



Messages sorted by: Reverse Date, Date, Thread, Author