Skip to content

Commit

Permalink
Write test should fail on timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
amuraru committed Jun 15, 2014
1 parent 663a4af commit 9d7da25
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions check_mountpoints.sh
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,19 @@ for MP in ${MPS} ; do
elif [ ${WRITETEST} -eq 1 ]; then
## if wanted, check if it is writable
TOUCHFILE=${MP}/.mount_test_from_$(hostname)
touch ${TOUCHFILE} &>/dev/null
if [ $? -ne 0 ]; then
touch ${TOUCHFILE} &>/dev/null &
TOUCHPID=$!
for (( i=1 ; i<$TIME_TILL_STALE ; i++ )) ; do
if ps -p $TOUCHPID > /dev/null ; then
sleep 1
else
break
fi
done
if ps -p $TOUCHPID > /dev/null ; then
$(kill -s SIGTERM $TOUCHPID &>/dev/null)
log "CRIT: ${TOUCHFILE} is not writable."
ERR_MESG[${#ERR_MESG[*]}]="${TOUCHFILE} is not writable."
ERR_MESG[${#ERR_MESG[*]}]="Could not write in ${MP} in $TIME_TILL_STALE sec. Seems to be stale."
else
rm ${TOUCHFILE} &>/dev/null
fi
Expand Down

0 comments on commit 9d7da25

Please sign in to comment.