3 # blockdev This shell script takes care of starting and stopping blockdev.
5 # chkconfig: 2345 01 99
6 # description: blockdev
8 # processname: blockdev
12 # Source function library.
13 . /etc/rc.d/init.d/functions
15 # Source blockdev configureation.
16 [ -f /etc/sysconfig/blockdev ] && . /etc/sysconfig/blockdev
19 if [ ! -f /var/lock/subsys/blockdev ]; then
20 for var in $(awk -F= '!/^#/ && !/^$/ {if ($2) print $1}' /etc/sysconfig/blockdev); do
22 drive=${var#BLOCKDEV_}
23 if [ -d "/sys/block/${drive}" -a -e "/dev/${drive}" ]; then
24 realdrive="/dev/${drive}"
25 elif [ -e "/dev/mapper/${drive}" ]; then
26 realdrive="/dev/mapper/${drive}"
27 elif drive=$(echo $drive | tr _ -) && [ -d "/sys/block/${drive}" -a -e "/dev/${drive}" ]; then
28 realdrive="/dev/${drive}"
29 elif [ -e "/dev/mapper/${drive}" ]; then
30 realdrive="/dev/mapper/${drive}"
33 if [ -n "$realdrive" ]; then
35 if [ -n "${PARAMS}" ]; then
36 show "Setting parameters for block drive %s (%s)" "$drive" "$PARAMS"
38 /sbin/blockdev ${PARAMS} $realdrive
44 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/blockdev
46 msg_already_running blockdev
52 if [ ! -f /var/lock/subsys/blockdev ]; then
53 msg_not_running blockdev
55 rm -f /var/lock/subsys/blockdev
59 # See how we were called.
76 msg_usage "$0 {start|stop|restart|force-reload|status}"