All pastes #732786 Raw Edit

Something

public text v1 · immutable
·published 2007-10-11 07:59 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`"
        ;;
servers)
        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 cat /etc/fstab | awk '{print $2}' | grep '^/$'| wc -l > $LOG 2>/dev/null


TAIL=`tail -1 $LOG`

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


        echo -e ${h} '\E[31;31m: IDE' ;
        tput sgr0
        echo "############" ;
else


        echo -e ${h} '\E[34;34m: SATA|SCSI';
        tput sgr0
        echo "############" ;


fi


done

rm -fr /var/tmp/disk-check.log