All pastes #731939 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-10-10 14:56 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
#CHECK_IDE=`grep sda /etc/fstab | wc -l`
#MACHINE=`uname -n`
TAIL=`tail -1 $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


#if [ "$CHECK_IDE" = "0" ] ; then

#if [ ! $? = 0 ] ; then

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



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

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


fi

done