#!/bin/sh # autofs pm-utils integration script to try to disconnect everything mounted # using automount when going into suspend/hibernate # # Based on /etc/apm/event.d/autofs and /etc/wpa_supplicant/action_wpa.sh # # Copyright: Copyright (c) 2010 Mikko Hänninen # License: GPL-2 # Expire any automounted file systems when suspending. We don't stop autofs, # since there might still be lots of active files on these filesystems (so # stopping might easily fail). PATH=/sbin:/usr/sbin:/bin:/usr/bin case "${1}" in suspend|hibernate) # Each automount daemon leaves its pid in one of these files for i in /var/run/autofs/*.pid; do pid=$(head -n 1 $i 2>/dev/null) [ "$pid" = "" ] && continue # SIGUSR1 makes the daemon unmount any unused filesystems # without quitting kill -USR1 $pid done ;; resume|thaw) # nothing to do ;; esac