Tryag File Manager
Home
-
Turbo Force
Current Path :
/
etc
/
rc1.d
/
Upload File :
New :
File
Dir
//etc/rc1.d/K87multipathd
#!/bin/bash # # /etc/rc.d/init.d/multipathd # # Starts the multipath daemon # # chkconfig: - 06 87 # description: Manage device-mapper multipath devices # processname: multipathd DAEMON=/sbin/multipathd prog=`basename $DAEMON` initdir=/etc/rc.d/init.d lockdir=/var/lock/subsys sysconfig=/etc/sysconfig syspath=/sys/block system=redhat if [ $system = redhat ]; then # Source function library. . $initdir/functions fi test -r $sysconfig/$prog && . $sysconfig/$prog RETVAL=0 teardown_slaves() { pushd $1 > /dev/null if [ -d "slaves" ]; then for slave in slaves/*; do if [ "$slave" = "slaves/*" ]; then read dev < $1/dev tablename=`dmsetup table --target multipath | sed -n "s/\(.*\): .* $dev .*/\1/p"` if ! [ -z $tablename ]; then echo "Root is on a multipathed device, multipathd can not be stopped" exit 1 fi else local_slave=`readlink -f $slave`; teardown_slaves $local_slave; fi done else read dev < $1/dev tablename=`dmsetup table --target multipath | sed -n "s/\(.*\): .* $dev .*/\1/p"` if ! [ -z $tablename ]; then echo "Root is on a multipathed device, multipathd can not be stopped" exit 1 fi fi popd > /dev/null } # # See how we were called. # start() { test -x $DAEMON || exit 5 echo -n $"Starting $prog daemon: " daemon $DAEMON RETVAL=$? [ $RETVAL -eq 0 ] && touch $lockdir/$prog echo } check_root() { root_dev=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/mtab) dm_num=`dmsetup info -c --noheadings -o minor $root_dev 2> /dev/null` if [ $? -eq 0 ]; then root_dm_device="dm-$dm_num" [ -d $syspath/$root_dm_device ] && teardown_slaves $syspath/$root_dm_device fi } stop() { echo -n $"Stopping $prog daemon: " killproc $DAEMON RETVAL=$? [ $RETVAL -eq 0 ] && rm -f $lockdir/$prog echo } force_queue_without_daemon() { $DAEMON -k"forcequeueing daemon" } restart() { force_queue_without_daemon stop start } reload() { echo -n "Reloading $prog: " trap "" SIGHUP killproc $DAEMON -HUP RETVAL=$? echo } case "$1" in start) start ;; stop) check_root stop ;; reload) reload ;; restart) restart ;; condrestart) if [ -f $lockdir/$prog ]; then restart fi ;; status) status $prog RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}" RETVAL=3 esac exit $RETVAL