rc.resume revision 285830
1267843Sdelphij#!/bin/sh
2267843Sdelphij#
3330569Sgordon# Copyright (c) 1999  Mitsuru IWASAKI
4267843Sdelphij# All rights reserved.
5267843Sdelphij#
6267843Sdelphij# Redistribution and use in source and binary forms, with or without
7267843Sdelphij# modification, are permitted provided that the following conditions
8267843Sdelphij# are met:
9267843Sdelphij# 1. Redistributions of source code must retain the above copyright
10267843Sdelphij#    notice, this list of conditions and the following disclaimer.
11267843Sdelphij# 2. Redistributions in binary form must reproduce the above copyright
12267843Sdelphij#    notice, this list of conditions and the following disclaimer in the
13267843Sdelphij#    documentation and/or other materials provided with the distribution.
14330569Sgordon#
15330569Sgordon# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16330569Sgordon# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17267843Sdelphij# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18267843Sdelphij# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19267843Sdelphij# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20267843Sdelphij# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21267843Sdelphij# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22330569Sgordon# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23330569Sgordon# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24330569Sgordon# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25330569Sgordon# SUCH DAMAGE.
26330569Sgordon#
27330569Sgordon# $FreeBSD: releng/10.2/etc/rc.resume 252686 2013-07-04 07:32:40Z rpaulo $
28330569Sgordon#
29267843Sdelphij
30267843Sdelphij# sample run command file for APM Resume Event
31267843Sdelphij
32267843Sdelphijif [ $# -ne 2 ]; then
33267843Sdelphij	echo "Usage: $0 [apm|acpi] [standby,suspend|1-4]"
34267843Sdelphij	exit 1
35330569Sgordonfi
36267843Sdelphij
37267843Sdelphijsubsystem=$1
38330569Sgordonstate=$2
39267843Sdelphij
40267843Sdelphijif [ -r /var/run/rc.suspend.pid ]; then
41330569Sgordon	kill -9 `cat /var/run/rc.suspend.pid`
42267843Sdelphij	/bin/rm -f /var/run/rc.suspend.pid
43267843Sdelphij	echo 'rc.resume: killed rc.suspend that was still around'
44267843Sdelphijfi
45267843Sdelphij
46330569Sgordon# Turns on a power supply of a card in the slot inactivated.
47330569Sgordon# See also contrib/pccardq.c (only for PAO users).
48330569Sgordon# pccardq | awk -F '~' '$5 == "inactive" \
49330569Sgordon#	{ printf("pccardc power %d 1", $1); }' | sh
50330569Sgordon
51330569Sgordon# If a device driver has problems resuming, try unloading it before
52330569Sgordon# suspend and reloading it on resume.  Example:
53330569Sgordon# kldload usb
54267843Sdelphij
55330569Sgordon/usr/bin/logger -t $subsystem resumed at `/bin/date +'%Y%m%d %H:%M:%S'`
56330569Sgordon/bin/sync && /bin/sync && /bin/sync
57330569Sgordon
58330569Sgordonexit 0
59330569Sgordon