#!/bin/sh
# @(#) haz-lx.rc /main/5 Jan_18_14:37

# RedHat/TurboLinux --- see chkconfig(8)
# chkconfig: 2345 98 98
# description: Modify sd device timeout values
# processname:
#
# SuSe --- see insserv(8) and init.d(7)
### BEGIN INIT INFO
# Provides: sd device timeout value
# Required-Start:
# Required-Stop: 
# Default-Start: 3 5
# Default-Stop: 0 1 6
# Description: Modify sd device timeout values
### END INIT INFO

PATH=/usr/sbin:/sbin:/usr/bin:/bin:/etc
export PATH

NEWTIMEOUT=300
ORIGTIMEOUT=30

case "$1" in
  start) 
    echo -n "Setting new timeout values for sd devices to ${NEWTIMEOUT} seconds."
     ls  /sys/block/sd*/device/timeout | 
	while read file ; do echo ${NEWTIMEOUT} > $file ; done
    echo
    ;;
  stop) 
    echo -n "Setting original timeout values for sd devices to ${ORIGTIMEOUT} seconds."
     ls  /sys/block/sd*/device/timeout | 
	while read file ; do echo ${ORIGTIMEOUT} > $file ; done
    echo
    ;;
  view)
    grep "" /sys/block/sd*/device/timeout
    ;;
  *) # status, restart, reload, etc
    echo "Usage: $0 {start|stop}"
    exit 1
    ;;
esac
exit 0
