#!/bin/sh # # Startup script for OCFS on experimental kernels for FireWire-based shared storage # # chkconfig: 2345 24 20 # # description: Service script for OCFS on experimental kernels for FireWire-based shared storage # . /etc/rc.d/init.d/functions case "$1" in start) if grep '^ohci1394 ' /proc/modules >/dev/null 2>&1 then echo -n "ohci1394: is already loaded " success $"ohci1394: is already loaded " else echo -n "Loading ohci1394: " /sbin/modprobe ohci1394 > /dev/null && \ success $"Loading ohci1394: " || failure $"Loading ohci1394: " fi echo if grep '^sbp2 ' /proc/modules >/dev/null 2>&1 then echo -n "sbp2: is already loaded " success $"sbp2: is already loaded " else echo -n "Loading sbp2: " /sbin/modprobe sbp2 > /dev/null && \ success $"Loading sbp2: " || failure $"Loading sbp2: " fi echo echo -n "Rescanning SCSI bus: " /usr/local/bin/rescan-scsi-bus.sh > /dev/null && \ success $"Rescanning SCSI bus: " || failure $"Rescanning SCSI bus: " echo ANY="`awk '/^[ ]*#/{next}$4 ~ /^noauto$|^noauto,|,noauto$/{next}$3 == "ocfs"{print $2}' /etc/fstab 2>/dev/null`" if [[ $ANY ]] then if grep '^ocfs ' /proc/modules >/dev/null 2>&1; then echo -n "OCFS is already loaded: " success $"OCFS is already loaded: " else echo -n "Loading OCFS: " /sbin/load_ocfs > /dev/null && \ success $"Loading OCFS: " || failure $"Loading OCFS: " fi fi echo ANY="`awk '/^[ ]*#/{next}$4 ~ /^noauto$|^noauto,|,noauto$/{next}$3 == "ocfs"{print $2}' /etc/fstab 2>/dev/null`" if [[ $ANY ]] then echo -n $"Mounting OCFS file systems: " /bin/mount -a -t ocfs > /dev/null && \ success $"Mounting OCFS file systems: " || failure $"Mounting OCFS file systems: " fi echo ;; stop) echo -n "Unmounting OCFS file systems: " /bin/umount -a -t ocfs > /dev/null && success $"Unmounting OCFS file systems: " || failure $"Unmounting OCFS file systems: " echo # It seems that OCFS can't be removed once it's loaded #echo -n "Unloading OCFS: " #/sbin/rmmod ocfs > /dev/null && \ # success $"Unloading OCFS: " || failure $"Unloading OCFS: " #echo echo -n "Unloading sbp2: " /sbin/rmmod sbp2 > /dev/null && \ success $"Unloading sbp2: " || failure $"Unloading sbp2: " echo echo -n "Unloading ohci1394: " /sbin/rmmod ohci1394 > /dev/null && success $"Unloading ohci1394: " || failure $"Unloading ohci1394: " echo ;; mount) ANY="`awk '/^[ ]*#/{next}$4 ~ /^noauto$|^noauto,|,noauto$/{next}$3 == "ocfs"{print $2}' /etc/fstab 2>/dev/null`" if [[ $ANY ]] then echo $"Mounting OCFS file systems: " /bin/mount -a -t ocfs > /dev/null && \ success $"Mounting OCFS file systems: " || failure $"Mounting OCFS file systems: " fi echo ;; umount) echo -n "Unmounting OCFS file systems: " /bin/umount -a -t ocfs > /dev/null && \ success $"Unmounting OCFS file systems: " || failure $"Unmounting OCFS file systems: " echo ;; restart) $0 stop $0 start ;; status) /bin/mount -t ocfs echo ;; *) echo "Usage: $0 {start|stop|restart|status|mount|umount}" exit 1 esac exit 0