All pastes #731958 Raw Edit

Untitled

public text v1 · immutable
·published 2007-10-10 15:20 UTC
rendered paste body
#!/bin/bash
# script for checking IDE/SATA disk for Linux


DATE=`date "+Date courante: %Y-%m-%d%nHeure: %H:%M:%S"`
LOG=/var/tmp/disk-check.log

source /etc/verimag/functions

type=$1

if [ x$type = x ] ; then
        printf "usage debian-disk-check sarge|etch|servers\n"
        exit 0
fi

case "$1" in

sarge)
        hlist="`hosts debian-linux-3.1`"
        ;;
etch)
        hlist="`hosts debian-linux-4.0`"
        ;;
serveurs)
        hlist="`hosts debian server`"
        ;;
esac

clear;

echo -en "~~~~~~~~~~~~~~~~~~~~\n"
echo  $DATE
echo -en "~~~~~~~~~~~~~~~~~~~~\n"
echo -en "                    \n"

sleep 1;

for h in ${hlist} ; do

ssh $h grep sda /etc/fstab | wc -l > $LOG 2>/dev/null


TAIL=`tail -1 $LOG`

if [ "$TAIL" = "0" ] ; then

sleep 1;

        echo  "We have an IDE disk  on : "${h}  ;
        echo "#######################################" ;
else

        echo "We have a SATA disk  on : "${h} ;
        echo "#######################################";


fi


done