#!/bin/sh -e # Company: PowerCraft Technology # Author: Copyright Jelle de Jong # Note: Please send me an email if you enhanced this script # System: Ubuntu Linux and Debian GNU/Linux # Version: 0.0.7 # Date: 03-04-2008 / 12-06-2009 # Description: disconnecting auto sshfs mounts in an organized matter # Command: /etc/network/if-down.d/sshfs-storage-umount # Did the script work for you? # Yes # Yes, but with some errors # Yes, but I had to change some things # Not at all # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. # set -x # exec 2>/var/log/sshfs-storage-umount.log [ -r /etc/default/sshfs-storage-config ] && . /etc/default/sshfs-storage-config if [ "$ENABLE" -ne "1" ]; then exit 0 fi if [ "$METHOD" = loopback ]; then exit 0 fi if [ "$IFACE" = lo ]; then exit 0 fi PATH=/sbin:/bin:/usr/sbin:/usr/bin awk '/^sshfs/ && $2 != "" {print $2}' /etc/mtab | while read location do umount -l "$location" echo "sshfs-storage: umounting $location" done exit 0