[go: up one dir, main page]

Menu

[r35]: / trunk / oscheck  Maximize  Restore  History

Download this file

31 lines (28 with data), 816 Bytes

#! /bin/bash

if [ -z $1 ]; then
   echo "Usage: oscheck start|stop|status"
   exit 1
fi

cd /sys/block
for RAID in md[0-9]*; do
   if [ $1 = "start" ]; then
      if [ $(cat /sys/block/${RAID}/md/sync_action) = idle ]; then
         echo "Starting check for ${RAID}"
         echo check >> /sys/block/${RAID}/md/sync_action 
      fi
   elif [ $1 = "stop" ]; then
      if [ $(cat /sys/block/${RAID}/md/sync_action) = check ]; then
         echo "Stopping check for ${RAID}"
         echo idle >> /sys/block/${RAID}/md/sync_action 
      fi
   elif [ $1 = "status" ]; then
      if [ $(cat /sys/block/${RAID}/md/sync_action) = check ]; then
         echo "${RAID} is checking"
      else
         echo "${RAID} is NOT checking"
      fi
   else
      echo "Usage: oscheck start|stop|status"
      exit 1
   fi
done