File: autofs.event.d

package info (click to toggle)
autofs 3.9.99-4.0.0pre10-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 324 kB
  • ctags: 15
  • sloc: sh: 656; makefile: 185
file content (34 lines) | stat: -rw-r--r-- 755 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
set -e

# only run this script if the system is going into suspend
if [ "$1" != "suspend" ]; then
	exit 0
fi

# Script to unmount any automounted filesystems when suspending
# Taken from /etc/init.d/autofs
# Ian Redfern (redferni@logica.com)

# The name and location of the daemon
DAEMON=/usr/sbin/automount

# Check if automount exists
test -f $DAEMON || exit 0

PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH

# Each automount daemon leaves its pid in one of these files
set -- /var/run/autofs/*.pid
if [ "$1" = "/var/run/autofs/*.pid" ]; then
	exit 0
fi
while [ $# -gt 0 ]; do
	pid=$(head -n 1 $1 2>/dev/null)
	if [ "$pid" ]; then
		# SIGUSR1 makes the daemon unmount any unused filesystems without quitting
		kill -USR1 $pid
	fi
	shift
done