Subject: Re: shutdown over ssh
To: Martin Ammermueller <martin81@bnro.de>
From: Matthias Buelow <mkb@mukappabeta.de>
List: netbsd-users
Date: 05/20/2001 17:39:39
Martin Ammermueller writes:

>Another strange behaviour of ksh:
>When I execute "shutdown -r now" from a local terminal from
>within the ksh, the ksh returns¹ to the controlling terminal
>between "$date $hostname syslogd: exiting on signal 15" and
>"syncing disks". Is this a bug?

What's the ksh got to do with this?  The shutdown command forks off a
worker process that does the waiting and all and which is detached from
the tty (unless invoked with the -D switch), so that it doesn't get HUPed
etc.
Naturally, the ksh prints its prompt when the process group leader from
the foreground process group exits (and thus control is transferred
back to the shell.)  The other shells should do this aswell, but since
there's some race condition with "shutdown -r now" as to whether the shell
gets run before the shutdown child pulls the trigger, maybe it was pure
chance that you observed this only with the ksh.

--mkb