#! /bin/sh
#
# this is a very outdated script. please verify it before using it...
#
# Copyright (c) 1996 S.u.S.E. Gmbh Fuerth, Germany.  All rights reserved.
#
# Author: Florian La Roche <florian@suse.de>, 1996-1998
#	  Werner Fink <werner@suse.de>, 1996
#
# This script is run when the UPS tells the system
# the power has gone. Tell everybody, sync the disks
# and drop into single user mode as fast as possible.
# This script is also being run when the power comes
# up again (if it does in time!)
#

PATH=/sbin:/bin:/usr/bin:/usr/sbin
HOME=/root
TERM=linux
export PATH HOME TERM

case "$1" in
    start)	wall "THE POWER IS DOWN! SHUTTING DOWN SYSTEM!"
		echo "POWER FAILURE" > /etc/nologin
		;;
    now)	trap "" SIGTERM
		init -t5 S
		;;
    stop)	rm -f /etc/nologin
		if test "$RUNLEVEL" != S ; then
			exit 0
		fi
		init $PREVLEVEL
		;;
  *)		echo "Usage: $0 {start|now|stop}"
		exit 1
		;;
esac

exit 0
