From: Branko Lankester (lankeste@fwi.uva.nl)
Date: 05/29/92


From: lankeste@fwi.uva.nl (Branko Lankester)
Subject: Re: shutdown procedure?
Date: 29 May 1992 10:57:39 GMT

rad@think.com (Bob Doolittle) writes:

>Actually, it's slightly (but importantly!) more complex. First it sends a
>signal SIGTERM (15) to all processes and waits for them to die, then if
>they stuck around it sends a SIGKILL (9) which is uncatchable.

I have these lines in my halt/reboot script:

trap "" 1 15
kill -TSTP 1
kill -15 -1 2>/dev/null
sleep 3
kill -9 -1 2>/dev/null
sleep 1

if kill -9 -1 2>/dev/null
then
        echo "WARNING: some process(es) wouldn't die"
fi
sync

You need a shell with a builtin kill for this (bash, ksh), and you
must run it as root.

Branko