I shutdown my system this way: shutdown -g0
Most of the time it works, but sometimes it halts and I have to use
may interrupt key and try again.
This is particularly bad when my nobreak software is shuting down my
system, because it calls 'shutdown -g0' as well, and after waiting for
180 seconds ( time enough to shutdown after calling 'init 0' ), it
switches off the energy with shutdown halted.
After tracing shutdown, I found that it halts when executing:
dspmsg $MF_SHUTDOWN ..... THE SYSTEM IS BEING SHUTDOWN NOW.....' |
If put a comment on it, shutdown always works well.
My system is SCO 5.04 with all main patches applied. I would like to
know if this happens with your system as well and if you know the
`wall` tries to write a message to every terminal that has a user logged
in. If one of the terminals is hung, wall might hang as well.
Get `lsof` (ftp://vic.cc.purdue.edu/pub/tools/unix/lsof). When a
shutdown hangs like that, don't interrupt it. Find the hung `wall`
process and run lsof on it:
# lsof -c wall
It may have a tty device open (e.g. /dev/ttyp99). If you access the
same port (echo foo > /dev/ttyp99&), that process will also hang,
showing that you've found the culprit.
One way to handle this would be to put all the `wall` commands in
/etc/shutdown into the background:
} | /etc/wall &
Then they might hang, but they won't stop the shutdown process.
If you do this, be aware that wall might hang before the last terminal.
It does the terminals in a consistent order. Users who are on terminals
after the hung one will have no warning at all of the shutdown.