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

#-------------------------------------------------------------------
# unmount /spare from all clients
#-------------------------------------------------------------------

# /usr/local/admin/umount_clients

if [ $? = 0 ] ; then

    for host in $(cat /usr/local/admin/hosts) ; do

	echo -n "Sending reboot command to $host ..... "
	rsh $host "/sbin/shutdown -r now" && echo " ok "

    done;
    exit 0
fi

echo -e "\aError unmounting file systems" 
exit 1


