Listing 2. Code to Kill Processes before Shutting Down
# kill anything you started
killall inetd
killall sendmail
killall klogd
killall syslogd
# kill anything else
kill -TERM -1
sleep 2
kill -KILL -1
# release the disks
swapoff -a
umount -a
mount -n -o remount,ro /
echo "The system is halted"
exit