#!/sbin/runscript # Distributed under the terms of the GNU General Public License v2 # # kindly provided by Ron O'Hara, see # http://thread.gmane.org/gmane.comp.linux.drbd/6429 opts="${opts} reload" DRBDADM="/sbin/drbdadm" PROC_DRBD="/proc/drbd" MODPROBE="modprobe" RMMOD="rmmod" function assure_module_is_loaded { [ -e "$PROC_DRBD" ] && return $MODPROBE -s drbd `$DRBDADM sh-mod-parms` || { echo "Can not load the drbd module."$'\n'; exit 20 } } depend() { use logger need net before heartbeat } start() { ebegin "Starting DRBD" assure_module_is_loaded # strange that gentoo thinks this should be done by an init script for i in `seq 0 15` ; do test -b /dev/drbd$i || mknod -m 0660 /dev/drbd$i b 147 $i; done ${DRBDADM} up all # /sbin/drbdadm wait_connect all eend $ret } stop() { ebegin "Stopping DRBD" ${DRBDADM} down all ret=$? $RMMOD drbd eend $ret } status() { # NEEDS to be heartbeat friendly... # so: put some "OK" in the output. ebegin "Status of DRBD" if [ -e $PROC_DRBD ]; then echo "drbd driver OK; device status:" cat "$PROC_DRBD" eend 0 else echo >&2 "drbd not loaded" eend 3 fi } reload() { ebegin "Reloading DRBD" assure_module_is_loaded ${DRBDADM} adjust all eend $? }