#!/bin/sh # # Startup a Linux cluster # Version 0.1 # spd at daphne.cps.unizar.es # Tue Nov 22 16:12:59 CET 2005 # # Requires wakeonlan # VERSION="0.1" DO=echo HOSTS=${HOSTS:="setme"} #HOSTS=setme HOSTNAME=`hostname` # # Customize this so "HOSTS" is the list of your nodes # if [ "$HOSTS" = "setme" ] then HOSTS=`awk '/^192.*atpc-n/{print $3}' /etc/hosts` fi CMD=`basename $0` usage() { echo "Use: $0 -VIDhny" echo " -V: version" #echo " -I: internet version" #echo " -D: download and install update" echo " -h: help" echo " -n: do nothing (default)" echo " -y: do it" exit 1 } set -- `getopt VIDhny $*` for i in $* do case $i in -y) DO=; shift;; -n) DO=echo; shift;; -V) echo "$VERSION"; exit 0;; -I) echo "not implemented" exit 1 ;; -D) echo "not implemented" exit 1 ;; -h) usage ;; esac done WAKE=/usr/local/etc/wakeonlan getmac() { awk -F"[ ;]" "/host $1 /"'{h=1;} /hardware ethernet/ {if (h==1) { h=0; print $3;}} ' /etc/dhcpd.conf } echo "#### Encendiendo el cluster." for f in $HOSTS do if [ "$f" != "atpc-n01" ] then echo "##" $f MAC=`getmac $f` if [ "_$MAC" != "_" ] then $DO $WAKE -i 192.168.0.255 $MAC fi fi done