rc.suspend revision 124766
1234287Sdim#!/bin/sh 2234287Sdim# 3234287Sdim# Copyright (c) 1999 Mitsuru IWASAKI 4234287Sdim# All rights reserved. 5234287Sdim# 6234287Sdim# Redistribution and use in source and binary forms, with or without 7234287Sdim# modification, are permitted provided that the following conditions 8234287Sdim# are met: 9234287Sdim# 1. Redistributions of source code must retain the above copyright 10234287Sdim# notice, this list of conditions and the following disclaimer. 11234287Sdim# 2. Redistributions in binary form must reproduce the above copyright 12234287Sdim# notice, this list of conditions and the following disclaimer in the 13234287Sdim# documentation and/or other materials provided with the distribution. 14234287Sdim# 15234287Sdim# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16234287Sdim# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17234287Sdim# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18234287Sdim# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19234287Sdim# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20234287Sdim# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21234287Sdim# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22234287Sdim# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23234287Sdim# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24234287Sdim# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25234287Sdim# SUCH DAMAGE. 26234287Sdim# 27234287Sdim# $FreeBSD: head/etc/rc.suspend 124766 2004-01-21 03:03:40Z njl $ 28263508Sdim# 29263508Sdim 30263508Sdim# sample run command file for APM Suspend Event 31234287Sdim 32234287Sdimif [ $# -ne 2 ]; then 33234287Sdim echo "Usage: $0 [apm|acpi] [standby,suspend|1-5]" 34234287Sdim exit 1 35249423Sdimfi 36234287Sdim 37249423Sdimsubsystem=$1 38234287Sdimstate=$2 39234287Sdim 40234287Sdimif [ -r /var/run/rc.suspend.pid ]; then 41249423Sdim exit 1 42234287Sdimfi 43249423Sdim 44234287Sdimecho $$ 2> /dev/null > /var/run/rc.suspend.pid 45234287Sdim 46234287Sdim# If you have troubles on suspending with PC-CARD modem, try this. 47249423Sdim# See also contrib/pccardq.c (Only for PAO users). 48234287Sdim# pccardq | awk -F '~' '$5 == "filled" && $4 ~ /sio/ \ 49249423Sdim# { printf("pccardc power %d 0", $1); }' | sh 50234287Sdim 51234287Sdim# UHCI has trouble resuming so we just load/unload it. You 52234287Sdim# should add any other kernel modules you want unloaded here. 53249423Sdim# kldunload usb 54234287Sdim 55249423Sdimlogger -t $subsystem suspend at `date +'%Y%m%d %H:%M:%S'` 56234287Sdimsync && sync && sync 57234287Sdim[ $subsystem = "apm" ] && sleep 3 58234287Sdim 59249423Sdimrm -f /var/run/rc.suspend.pid 60234287Sdim[ $subsystem = "apm" ] && zzz 61249423Sdim 62234287Sdimexit 0 63234287Sdim