rc.resume revision 170976
165793Smsmith#!/bin/sh
265793Smsmith#
381188Sscottl# Copyright (c) 1999  Mitsuru IWASAKI
465793Smsmith# All rights reserved.
581188Sscottl#
665793Smsmith# Redistribution and use in source and binary forms, with or without
765793Smsmith# modification, are permitted provided that the following conditions
865793Smsmith# are met:
965793Smsmith# 1. Redistributions of source code must retain the above copyright
1065793Smsmith#    notice, this list of conditions and the following disclaimer.
1165793Smsmith# 2. Redistributions in binary form must reproduce the above copyright
1265793Smsmith#    notice, this list of conditions and the following disclaimer in the
1365793Smsmith#    documentation and/or other materials provided with the distribution.
1465793Smsmith#
1565793Smsmith# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1665793Smsmith# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1765793Smsmith# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1865793Smsmith# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1965793Smsmith# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2065793Smsmith# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2165793Smsmith# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2265793Smsmith# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2365793Smsmith# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2465793Smsmith# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2565793Smsmith# SUCH DAMAGE.
2665793Smsmith#
2765793Smsmith# $FreeBSD: head/etc/rc.resume 170976 2007-06-21 22:50:37Z njl $
2865793Smsmith#
2965793Smsmith
3065793Smsmith# sample run command file for APM Resume Event
3165793Smsmith
3270393Smsmithif [ $# -ne 2 ]; then
3370393Smsmith	echo "Usage: $0 [apm|acpi] [standby,suspend|1-4]"
3470393Smsmith	exit 1
3570393Smsmithfi
3670393Smsmith
3770393Smsmithsubsystem=$1
3870393Smsmithstate=$2
3970393Smsmith
4070393Smsmithif [ -r /var/run/rc.suspend.pid ]; then
4170393Smsmith	kill -9 `cat /var/run/rc.suspend.pid`
4270393Smsmith	rm -f /var/run/rc.suspend.pid
4370393Smsmith	echo 'rc.resume: killed rc.suspend that was still around'
4470393Smsmithfi
4570393Smsmith
4670393Smsmith# Turns on a power supply of a card in the slot inactivated.
4770393Smsmith# See also contrib/pccardq.c (only for PAO users).
4870393Smsmith# pccardq | awk -F '~' '$5 == "inactive" \
4970393Smsmith#	{ printf("pccardc power %d 1", $1); }' | sh
5070393Smsmith
5170393Smsmith# If a device driver has problems resuming, try unloading it before
5270393Smsmith# suspend and reloading it on resume.  Example:
5370393Smsmith# kldunload usb
5470393Smsmith
5570393Smsmith# wpa_supplicant(8) doesn't seem to reassociate during resume.  Uncomment
5670393Smsmith# the following to signal it to reassociate.
5765793Smsmith# /usr/sbin/wpa_cli reassociate
5865793Smsmith
5965793Smsmithlogger -t $subsystem resumed at `date +'%Y%m%d %H:%M:%S'`
6065793Smsmithsync && sync && sync
6165793Smsmith
6265793Smsmithexit 0
6365793Smsmith