#!/bin/bash
# file   : halt_clients
# author : Jacek Radajewski
# date   : 22 May 1997
#
# script to halt all clients
# 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
#-------------------------------------------------------------------

for host in $(cat /usr/local/admin/hosts) ; do
	echo -n "Sending halt command to $host ..... "
	rsh $host "/sbin/shutdown -h now" && echo " ok "

done;

