rc.suspend revision 124001
148734Siwasaki#!/bin/sh 248734Siwasaki# 366830Sobrien# Copyright (c) 1999 Mitsuru IWASAKI 466830Sobrien# All rights reserved. 566830Sobrien# 666830Sobrien# Redistribution and use in source and binary forms, with or without 766830Sobrien# modification, are permitted provided that the following conditions 866830Sobrien# are met: 966830Sobrien# 1. Redistributions of source code must retain the above copyright 1066830Sobrien# notice, this list of conditions and the following disclaimer. 1166830Sobrien# 2. Redistributions in binary form must reproduce the above copyright 1266830Sobrien# notice, this list of conditions and the following disclaimer in the 1366830Sobrien# documentation and/or other materials provided with the distribution. 1466830Sobrien# 1566830Sobrien# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1666830Sobrien# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1766830Sobrien# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1866830Sobrien# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1966830Sobrien# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2066830Sobrien# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2166830Sobrien# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2266830Sobrien# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2366830Sobrien# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2466830Sobrien# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2566830Sobrien# SUCH DAMAGE. 2666830Sobrien# 2750472Speter# $FreeBSD: head/etc/rc.suspend 124001 2003-12-30 17:28:06Z njl $ 2848734Siwasaki# 2966830Sobrien 3048734Siwasaki# sample run command file for APM Suspend Event 3148734Siwasaki 32124001Snjlif [ $# -ne 2 ]; then 33124001Snjl echo "Usage: $0 [apm|acpi] [standby,suspend|1-5]" 34124001Snjl exit 1 35124001Snjlfi 36124001Snjl 37124001Snjlsubsystem=$1 38124001Snjlstate=$2 39124001Snjl 4051231Ssheldonhif [ -r /var/run/rc.suspend.pid ]; then 4148734Siwasaki exit 1 4248734Siwasakifi 4348734Siwasaki 4448734Siwasakiecho $$ > /var/run/rc.suspend.pid 4548734Siwasaki 4648734Siwasaki# If you have troubles on suspending with PC-CARD modem, try this. 4748734Siwasaki# See also contrib/pccardq.c (Only for PAO users). 4851231Ssheldonh# pccardq | awk -F '~' '$5 == "filled" && $4 ~ /sio/ \ 4948734Siwasaki# { printf("pccardc power %d 0", $1); }' | sh 5048734Siwasaki 51124001Snjl# UHCI has trouble resuming so we just load/unload it. You 52124001Snjl# should add any other kernel modules you want unloaded here. 53124001Snjl# kldunload usb 54124001Snjl 55124001Snjllogger -t $subsystem suspend at `date +'%Y%m%d %H:%M:%S'` 5648734Siwasakisync && sync && sync 57124001Snjl[ $subsystem = "apm" ] && sleep 3 5848734Siwasaki 5948734Siwasakirm -f /var/run/rc.suspend.pid 60124001Snjl[ $subsystem = "apm" ] && zzz 6148734Siwasaki 6248734Siwasakiexit 0 63