#!/bin/bash # # ATA Over Ethernet (AOE) start/stop scripts. # `service aoe start` will modprobe aoe # `service aoe stop` will bring down all mounted aoe drives # `service aoe status` will provide the status of AOE # # To install so aoe is automatically started/stopped with the machine: # 1) Move this file to /etc/rc.d/init.d/aoe # 2) Create a link to this file called /etc/rc.d/rc3.d/S11aoe # 3) Create a link to this file called /etc/rc.d/rc0.d/K89aoe # 4) Create a link to this file called /etc/rc.d/rc6.d/K89aoe # # NOTE: Steps 2-4 are configuring aoe to automatically start on Init 3 # and get killed on Init 0 or Init 6. Change the numbers (S11, K89) as # needed to make sure AOE starts -after- the network in rc3.d and is # killed -before- the network in rc0.d and rc6.d # # (w) Lance Mosher October 27 2004 # (m) Lanee Mosher April 9 2005 . /etc/rc.d/init.d/functions lockfile=/var/lock/subsys/aoe mountpoint=/data/eth/ devpoint=/dev/etherd/ RETVAL=0 start() { echo -n $"Starting AOE: " modprobe aoe && success || failure #Bring up aoe module touch "$lockfile" RETVAL=$? echo } stop() { echo -n $"Stopping AOE: " drives=`df | grep $devpoint | awk '{print $1}'` #Create list of mounted drives for drive in $drives; do umount $drive #Unmount each drive done rmdir $mountpoint* #Remove mount points rmmod aoe && success || failure rm -f "$lockfile" RETVAL=$? echo } restart() { stop start } case "$1" in start) start ;; stop) stop ;; restart|force-reload) restart ;; status) if [ -f "$lockfile" ]; then echo 'AOE is ONLINE'; echo Mounted blades: `ls $mountpoint`; else echo 'AOE is OFFLINE'; fi ;; *) echo $"Usage: $0 {start|stop|status|restart|}" exit 1 esac exit $RETVAL