On Wed, Aug 12, 2009 at 09:01:05PM -0700, David Christensen wrote: > Osamu Aoki wrote: > > Test1: > > redirect STDOUT/STDERR > > $ sudo shutdown -h +1 >/dev/null 2>/dev/null & > > Thank you for your reply. :-) > > 2009-08-12 20:20:50 dpchr...@p43400e /cygdrive/u > $ ssh vmdebian500 'sudo shutdown -k +1 >/dev/null 2>/dev/null &' > 2009-08-12 20:20:50 dpchr...@p43400e /cygdrive/u > $ > > That does not block. Interesting, but I don't understand how/why it > works. Is this a feature of shutdown? sudo? ssh (I think not)? > Something more generic (console I/O?)? Is there something I can read > which explains this?
Without ">/dev/null 2>/dev/null", thus "sudo shutdown" process has its file connected to terminal. So upon killing SSH connection, SSH will send its subprocess SIGTERM. When terminal using program recieve SIGTERM and do not do fancy thing as screen, its is killed by kernel to enable unlinking of these files. All daemon redirect STDERR/STDOUT before going background. You can test this by starting some program on xterm. send it to back ground. If they have their STDOUT connected to terminal, upon killing parent xterm, you kill process. That much I know as common sense. I never looked into SIGTERM handling in details though. Osamu -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org