zzz.sh (035e325c81b75ea3b5c878c55cc133672b6ac06d) zzz.sh (c6c051e598b7e553b0e28ccb12780d33cd84399e)
1#!/bin/sh
2#
3# Suspend the system using either ACPI or APM.
4# For APM, "apm -z" will be issued.
5# For ACPI, the configured suspend state will be looked up, checked to see
6# if it is supported, and "acpiconf -s <state>" will be issued.
7#
8# Mark Santcroos <marks@ripe.net>

--- 4 unchanged lines hidden (view full) ---

13
14ACPI_SUSPEND_STATE=hw.acpi.suspend_state
15ACPI_SUPPORTED_STATES=hw.acpi.supported_sleep_state
16APM_SUSPEND_DELAY=machdep.apm_suspend_delay
17
18# Check for ACPI support
19if sysctl $ACPI_SUSPEND_STATE >/dev/null 2>&1; then
20 # Get configured suspend state
1#!/bin/sh
2#
3# Suspend the system using either ACPI or APM.
4# For APM, "apm -z" will be issued.
5# For ACPI, the configured suspend state will be looked up, checked to see
6# if it is supported, and "acpiconf -s <state>" will be issued.
7#
8# Mark Santcroos <marks@ripe.net>

--- 4 unchanged lines hidden (view full) ---

13
14ACPI_SUSPEND_STATE=hw.acpi.suspend_state
15ACPI_SUPPORTED_STATES=hw.acpi.supported_sleep_state
16APM_SUSPEND_DELAY=machdep.apm_suspend_delay
17
18# Check for ACPI support
19if sysctl $ACPI_SUSPEND_STATE >/dev/null 2>&1; then
20 # Get configured suspend state
21 SUSPEND_STATE=`sysctl $ACPI_SUSPEND_STATE | sed 's|^.*: S||'`
21 SUSPEND_STATE=`sysctl -n $ACPI_SUSPEND_STATE `
22
23 # Get list of supported suspend states
22
23 # Get list of supported suspend states
24 SUPPORTED_STATES=`sysctl $ACPI_SUPPORTED_STATES | sed 's|^.*: ||'`
24 SUPPORTED_STATES=`sysctl -n $ACPI_SUPPORTED_STATES `
25
26 # Check if the configured suspend state is supported by the system
25
26 # Check if the configured suspend state is supported by the system
27 if echo $SUPPORTED_STATES | grep S$SUSPEND_STATE >/dev/null; then
27 if echo $SUPPORTED_STATES | grep $SUSPEND_STATE >/dev/null; then
28 # execute ACPI style suspend command
29 exec acpiconf -s $SUSPEND_STATE
30 else
28 # execute ACPI style suspend command
29 exec acpiconf -s $SUSPEND_STATE
30 else
31 echo -n "Requested suspend state S$ACPI_SUSPEND_STATE "
31 echo -n "Requested suspend state $SUSPEND_STATE "
32 echo -n "is not supported. "
32 echo -n "is not supported. "
33 echo "Supported states: $ACPI_SUPPORTED_STATES"
33 echo "Supported states: $SUPPORTED_STATES"
34 fi
35# Check for APM support
36elif sysctl $APM_SUSPEND_DELAY >/dev/null 2>&1; then
37 # Execute APM style suspend command
38 exec apm -z
39else
40 echo "Error: no ACPI or APM suspend support found."
41fi
42
43exit 1
34 fi
35# Check for APM support
36elif sysctl $APM_SUSPEND_DELAY >/dev/null 2>&1; then
37 # Execute APM style suspend command
38 exec apm -z
39else
40 echo "Error: no ACPI or APM suspend support found."
41fi
42
43exit 1