#!/bin/sh
#
# xlm-halt
# by Georg C. F. Greve <greve@gnu.org>
#
# This is a script for the Xlogmaster
#
# usage:
# xlm-halt <delay>
#

name="$XLM_NAME"
helptext="$XLM_HELP"
mode="$XLM_MODE"
line="$XLM_LINE"
delay="$*"

#
# first a short mail to root so the operator knows what has been going
# on...
#

echo -ne "Hi !\n\nAs required by you the machine will go down in \n\n\
$delay minutes because the Xlogmaster has seen the line\n\n\
$line\n\n\
in $name ($helptext)[mode: $mode].\n\n\
Regards,\n\
your Xlogmaster.\n\n" | mail -s "*** Xlogmaster shutdown message ***" root

#
# and now issue the "shutdown -h" with a short message to all users
#

/sbin/shutdown -h +$delay "The Xlogmaster regrets having to inform you that this system will go down in $delay minutes due to a critical event in $name..."

