#!/bin/bash # # lustrefs Mount Lustre filesystems. # # Authors: Jacob Berkman # # Based on the netfs script: # # Authors: Bill Nottingham # Miquel van Smoorenburg, # # chkconfig: 345 26 74 # description: Mounts and unmounts all Lustre mount points. # ### BEGIN INIT INFO # Provides: $local_fs $remote_fs ### END INIT INFO [ -f /etc/sysconfig/network ] || exit 0 . /etc/init.d/functions . /etc/sysconfig/network # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 0 LUSTREFSTAB=`LC_ALL=C awk '!/^#/ && $3 == "lustre" && $4 !~ /noauto/ { print $2 }' /etc/fstab` LUSTREMTAB=`LC_ALL=C awk '!/^#/ && $3 == "lustre" { print $2 }' /proc/mounts` # See how we were called. case "$1" in start) [ -n "$LUSTREFSTAB" ] && action $"Mounting Lustre filesystems: " mount -a -t lustre touch /var/lock/subsys/lustrefs ;; stop) [ -n "$LUSTREMTAB" ] && { sig= retry=3 remaining=`LC_ALL=C awk '!/^#/ && $3 ~ /^lustre/ && $2 != "/" {print $2}' /proc/mounts` while [ -n "$remaining" -a "$retry" -gt 0 ] do if [ "$retry" -lt 3 ]; then action $"Unmounting Lustre filesystems (retry): " umount -f -a -t lustre else action $"Unmounting Lustre filesystems: " umount -a -t lustre fi sleep 2 remaining=`LC_ALL=C awk '!/^#/ && $3 ~ /^lustre/ && $2 != "/" {print $2}' /proc/mounts` [ -z "$remaining" ] && break /sbin/fuser -k -m $sig $remaining >/dev/null sleep 5 retry=$(($retry - 1)) sig=-9 done } rm -f /var/lock/subsys/lustrefs ;; status) if [ -f /proc/mounts ] ; then [ -n "$LUSTREFSTAB" ] && { echo $"Configured Lustre mountpoints: " for fs in $LUSTREFSTAB; do echo $fs ; done } [ -n "$LUSTREMTAB" ] && { echo $"Active Lustre mountpoints: " for fs in $LUSTREMTAB; do echo $fs ; done } else echo $"/proc filesystem unavailable" fi ;; restart) $0 stop $0 start ;; reload) $0 start ;; *) echo $"Usage: $0 {start|stop|restart|reload|status}" exit 1 esac exit 0