#!/bin/bash
. /etc/profile
INIT=`ps -p 1 -o comm=`
if [ x$1 = x-w ]
then
	/sbin/halt-init -w
	exit 0
fi
chvt 1
if [ x$INIT = xrunit ]
then
 	 /sbin/halt-runit $@
else
     	/sbin/halt-init $@
fi