#!/bin/bash
# file   : halt_all
# author : Jacek Radajewski
# date   : 22 May 1997 
# 
# script to halt all the clients and then server alpha
# this script must be executed from alpha


#-------------------------------------------------------------------
# first check if started from alpha
#-------------------------------------------------------------------


if [ $(/bin/uname -n) != "alpha.beowulf.usq.edu.au" ] ; then
    echo "$0 : I must be started from alpha.beowulf.usq.edu.au"
    echo "$0 : I was started from $(/bin/uname -n)"
    exit 1
fi

#-------------------------------------------------------------------
# halt all clients
#-------------------------------------------------------------------

/usr/local/admin/halt_clients

#-------------------------------------------------------------------
# halt server
#-------------------------------------------------------------------

echo "Taking a nap for 30 seconds so clients have to time to unmount my file systems"

sleep 30

echo "Now it is my turn die ... "

/sbin/shutdown -h now "bye bye"
