83 lines
1.5 KiB
Bash
Executable File
83 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# $NetBSD: script,v 1.3 2000/06/18 16:16:34 hubertf Exp $
|
|
#
|
|
|
|
#
|
|
# Link this script to /etc/apm/{suspend,standby,resume,line,battery}
|
|
# to play some sounds on suspend/resume, and enable/shutdown the
|
|
# network card:
|
|
#
|
|
# mkdir /etc/apm
|
|
# cp script /etc/apm/suspend
|
|
# cd /etc/apm
|
|
# for i in standby resume line battery ; do ln suspend $i ; done
|
|
#
|
|
# See apmd(8) for more information.
|
|
#
|
|
|
|
|
|
PATH=/usr/pkg/bin:/sbin:$PATH
|
|
export PATH
|
|
|
|
# Where some sound files are stored:
|
|
S=/usr/X11R6/share/kde/sounds
|
|
|
|
# What my network card's recognized as:
|
|
if=ne0
|
|
|
|
|
|
noise() {
|
|
audioplay -q -f -s 22050 -c 1 $1
|
|
}
|
|
|
|
case $0 in
|
|
*suspend)
|
|
logger 'Suspending...'
|
|
noise $S/KDE_Window_UnMaximize.wav
|
|
# In case some NFS mounts still exist - we don't want them to hang:
|
|
umount -a -t nfs
|
|
umount -a -f -t nfs
|
|
ifconfig $if down
|
|
sh /etc/rc.d/dhclient stop
|
|
logger 'Suspending done.'
|
|
;;
|
|
|
|
*standby)
|
|
logger 'Going to standby mode ....'
|
|
noise $S/KDE_Window_UnMaximize.wav
|
|
# In case some NFS mounts still exist - we don't want them to hang:
|
|
umount -a -t nfs
|
|
umount -a -f -t nfs
|
|
ifconfig $if down
|
|
sh /etc/rc.d/dhclient stop
|
|
logger 'Standby done.'
|
|
;;
|
|
|
|
*resume)
|
|
logger Resuming...
|
|
noise $S/KDE_Startup.wav
|
|
sh /etc/rc.d/dhclient start
|
|
# mount /home
|
|
# mount /data
|
|
logger 'Resuming done.'
|
|
;;
|
|
|
|
*line)
|
|
# Running on power line, not battery...
|
|
# noise $S/KDE_Window_DeIconify.wav
|
|
mount -u -o atime,devmtime -a
|
|
atactl wd0 setidle 0
|
|
;;
|
|
|
|
*battery)
|
|
# Running on battery...
|
|
# noise $S/KDE_Window_DeIconify.wav
|
|
mount -u -o noatime,nodevmtime -a
|
|
atactl wd0 setidle 5
|
|
;;
|
|
|
|
esac
|
|
|
|
exit 0
|