#!/bin/sh # Eric Knibbe # CS 232 - Spring 2006 # Project 2 v1.0 # Anybody Home - This shell script iterates through a list of machines in # the uLab, checking each with the who command to see if anyone is logged # on. Any unused machines are listed. Currently only works with machines # booted into Linux. echo "Available machines:" # reads from the list of machines at the end of this file while read hostname; do # Compares the output of the who command with the contents of nousers.txt, # which contains the output of who when the machine is unnoccupied if ssh -n $hostname who | diff -q --ignore-all-space - nousers.txt > /dev/null; # print the machine name if there's no one on it then echo "$hostname" fi done <