#!/bin/sh # # Suspend the system using either ACPI or APM. # For APM, "apm -z" will be issued. # For ACPI, the configured suspend state will be looked up, checked to see # if it is supported, and "acpiconf -s " will be issued. # # Mark Santcroos # # $FreeBSD: stable/11/usr.sbin/zzz/zzz.sh 118020 2003-07-25 17:11:15Z njl $ setvar PATH = "/sbin:/usr/sbin:/usr/bin:/bin" setvar ACPI_SUSPEND_STATE = 'hw.acpi.suspend_state' setvar ACPI_SUPPORTED_STATES = 'hw.acpi.supported_sleep_state' setvar APM_SUSPEND_DELAY = 'machdep.apm_suspend_delay' # Check for ACPI support if sysctl $ACPI_SUSPEND_STATE >/dev/null 2>&1 { # Get configured suspend state setvar SUSPEND_STATE = $(sysctl -n $ACPI_SUSPEND_STATE) # Get list of supported suspend states setvar SUPPORTED_STATES = $(sysctl -n $ACPI_SUPPORTED_STATES) # Check if the configured suspend state is supported by the system if echo $SUPPORTED_STATES | grep $SUSPEND_STATE >/dev/null { # execute ACPI style suspend command exec acpiconf -s $SUSPEND_STATE } else { echo -n "Requested suspend state $SUSPEND_STATE " echo -n "is not supported. " echo "Supported states: $SUPPORTED_STATES" } # Check for APM support } elif sysctl $APM_SUSPEND_DELAY >/dev/null 2>&1 { # Execute APM style suspend command exec apm -z } else { echo "Error: no ACPI or APM suspend support found." } exit 1