I only found out maybe half a year ago why my SSH connections wouldn't
drop at times when I logged out. :) Anyway, finally got around to filing
a bug report, because PennMUSH is guilty of not properly daemonizing.
When you log out, SSH waits until all the file descriptors used by your
session have been closed. This often leads to a strange hanging situation
where you log out, but the session stays open and you have to do a ~. to
close the connection.
The usual culprit is a backgrounded application which has failed to
release stdout/stderr/etc. PennMUSH has such behavior, because it
gets backgrounded, prints a few messages to the output, and does not close
these file descriptors even after it redirects errors to a log file.
There are a few approaches to this. One is to simply redirect all output
to /dev/null from the restart script. A second approach is to use an
approach called daemonization. There are a few descriptions of how to do
this on the Web, but the whole idea seems overly complicated to me,
because it takes care of backgrounding the process and also attempts to
reopen stdin/stdout/stderr (I guess if you ever write to them by
accident). That's probably not necessary in most cases.
I think redirecting everything to /dev/null probably wouldn't be such a
bad thing. The output is marginally helpful for diagnosing problems, and
just giving a 'I'm alive' sort of message, but most of the times netmush
crashes on me, the error is printed after output is redirected to the
error log anyway. However, it probably wouldn't be too hard to do
something like close stdout before reopening stderr.