blob: de289395fc07c3fcdf1b219221748efecd75b98f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#!/bin/sh -
#
# $NetBSD: acadapter,v 1.4 2010/12/31 09:29:43 jruoho Exp $
#
# Generic script for acadapter events.
#
# Arguments passed by powerd(8):
#
# device event
case "${2}" in
pressed)
logger -p info "${0}: Full performance mode" >&1
# Disable power saving mode on all network interfaces.
#
for intf in $(/sbin/ifconfig -l); do
/sbin/ifconfig $intf -powersave >/dev/null 2>&1
done
# If you want to keep your hard disk idle while running
# on battery, the following commands will help.
#
# /sbin/atactl wd0 setidle 300
# /sbin/atactl wd0 setstandby 600
# Make sure syslogd is running.
#
# pkill syslogd
# /etc/rc.d/syslogd start
# Start cron daemon when running on power.
#
# /etc/rc.d/cron start
exit 0
;;
released)
logger -p info "${0}: Power saving mode" >&1
# Enable power saving mode on all network interfaces.
#
for intf in $(/sbin/ifconfig -l); do
/sbin/ifconfig $intf powersave >/dev/null 2>&1
done
# When running on battery, we want to keep the disk idle for as long
# as possible. Unfortunately, things like cron and syslog make this
# very difficult. If you can live without cron or persistent logging,
# you can use the commands below to disable cron and syslogd.
#
# If you still want to see syslog messages, you can create a custom
# /etc/syslog.conf.battery that writes messages to /dev/console or
# possibly a free wsdisplay screen. Alternatively, /var/log could
# be mounted as tmpfs.
# Disk idle timeouts.
#
# /sbin/atactl wd0 setidle 30
# /sbin/atactl wd0 setstandby 120
# Stop the cron daemon.
#
# /etc/rc.d/cron stop
# Restart syslogd using a diskless configuration.
#
# pkill syslogd
# /usr/sbin/syslogd -s -f /etc/syslog.conf.battery
exit 0
;;
*)
logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1
exit 1
;;
esac
|