I'm experiencing some strange behaviour with bash and xterm or other
   X-terminals.
   I'm using bash in Debian stable (GNU bash, Version 4.1.5(1)-release
   (i486-pc-linux-gnu)).
   To reproduce, write a simple script like this:
   #!/bin/bash
   (xclock &)
   sleep 15
   Then run it with xterm -e.
   xclock is not a child of xterm or bash (PPID=1) because it was invoked
   with "(xclock &)":
   F S UID        PID  PPID  C PRI  NI ADDR SZ WCHAN  STIME TTY
   TIME CMD
   0 S turin    23318     1  0  80   0 -  2292 -      17:52 pts/1
   00:00:00 xclock
   Yet xclock closes when the script exits because it receives a SIGHUP.
   Just strace the PID:
   Process 23318 attached - interrupt to quit
   restart_syscall(<... resuming interrupted call ...>) = ?
   ERESTART_RESTARTBLOCK (To be restarted)
   --- SIGHUP (Hangup) @ 0 (0) ---
   Process 23318 detached
   If you change the header in the script to #!/bin/tcsh or #!/bin/csh
   xclock does not receive a SIGHUP.
   Therefore I assume the problem is with bash.
   Same with disown:
   #!/bin/bash
   xclock &
   disown -a
   sleep 15
   If I execute the script in an interactive terminal and close the
   windows with the "x" button after the script finished xclock stays
   open.
   No SIGHUP. So where is that SIGHUP coming from in the other case? Any
   ideas? Am i missing something?
   regards

   SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
   kostenguenstig. Jetzt gleich testen! [1]http://f.web.de/?mc=021192

References

   1. http://f.web.de/?mc=021192

Reply via email to