#! /bin/sh ### BEGIN INIT INFO # Provides: umountcifs # Required-Start: # Required-Stop: umountcifs # Should-Stop: # Default-Start: # Default-Stop: 0 6 # Short-Description: Unmount all cifs filesystems and terminate all processes using them # Description: ### END INIT INFO PATH=/sbin:/usr/sbin:/bin:/usr/bin KERNEL="$(uname -s)" RELEASE="$(uname -r)" . /lib/init/vars.sh . /lib/lsb/init-functions case "${KERNEL}:${RELEASE}" in Linux:[01].*|Linux:2.[01].*) FLAGS="" ;; Linux:2.[23].*|Linux:2.4.?|Linux:2.4.?-*|Linux:2.4.10|Linux:2.4.10-*) FLAGS="-f" ;; *) FLAGS="-f -l" ;; esac do_stop () { # # Make list of points to unmount in reverse order of their creation # exec 9<&0 /dev/null 2>&1" || break sleep 1 done log_action_begin_msg "Killing all remaining processes using cifs filesystems" echo "kill -9 $PROCESSES > /dev/null 2>&1" # SIGKILL log_action_end_msg 0 fi # Unmount all cifs filesystems [ "$VERBOSE" = no ] || log_action_begin_msg "Unmounting remote and non-toplevel cifs filesystems" umount $FLAGS $DIRS ES=$? [ "$VERBOSE" = no ] || log_action_end_msg $ES fi } case "$1" in start) # No-op ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop|"") do_stop ;; *) echo "Usage: umountcifs [start|stop]" >&2 exit 3 ;; esac :