script revision 1.3
11.1Shubertf#!/bin/sh 21.1Shubertf# 31.3Shubertf# $NetBSD: script,v 1.3 2000/06/18 16:16:34 hubertf Exp $ 41.1Shubertf# 51.1Shubertf 61.1Shubertf# 71.1Shubertf# Link this script to /etc/apm/{suspend,standby,resume,line,battery} 81.1Shubertf# to play some sounds on suspend/resume, and enable/shutdown the 91.3Shubertf# network card: 101.3Shubertf# 111.3Shubertf# mkdir /etc/apm 121.3Shubertf# cp script /etc/apm/suspend 131.3Shubertf# cd /etc/apm 141.3Shubertf# for i in standby resume line battery ; do ln suspend $i ; done 151.3Shubertf# 161.3Shubertf# See apmd(8) for more information. 171.1Shubertf# 181.1Shubertf 191.1Shubertf 201.1ShubertfPATH=/usr/pkg/bin:/sbin:$PATH 211.1Shubertfexport PATH 221.1Shubertf 231.1Shubertf# Where some sound files are stored: 241.1ShubertfS=/usr/X11R6/share/kde/sounds 251.1Shubertf 261.1Shubertf# What my network card's recognized as: 271.1Shubertfif=ne0 281.1Shubertf 291.1Shubertf 301.3Shubertfnoise() { 311.3Shubertf audioplay -q -f -s 22050 -c 1 $1 321.3Shubertf} 331.3Shubertf 341.1Shubertfcase $0 in 351.1Shubertf*suspend) 361.1Shubertf logger 'Suspending...' 371.3Shubertf noise $S/KDE_Window_UnMaximize.wav 381.1Shubertf # In case some NFS mounts still exist - we don't want them to hang: 391.1Shubertf umount -a -t nfs 401.1Shubertf umount -a -f -t nfs 411.1Shubertf ifconfig $if down 421.3Shubertf sh /etc/rc.d/dhclient stop 431.1Shubertf logger 'Suspending done.' 441.1Shubertf ;; 451.1Shubertf 461.1Shubertf*standby) 471.1Shubertf logger 'Going to standby mode ....' 481.3Shubertf noise $S/KDE_Window_UnMaximize.wav 491.1Shubertf # In case some NFS mounts still exist - we don't want them to hang: 501.1Shubertf umount -a -t nfs 511.1Shubertf umount -a -f -t nfs 521.1Shubertf ifconfig $if down 531.3Shubertf sh /etc/rc.d/dhclient stop 541.1Shubertf logger 'Standby done.' 551.1Shubertf ;; 561.1Shubertf 571.1Shubertf*resume) 581.1Shubertf logger Resuming... 591.3Shubertf noise $S/KDE_Startup.wav 601.3Shubertf sh /etc/rc.d/dhclient start 611.1Shubertf # mount /home 621.1Shubertf # mount /data 631.1Shubertf logger 'Resuming done.' 641.1Shubertf ;; 651.1Shubertf 661.1Shubertf*line) 671.3Shubertf # Running on power line, not battery... 681.3Shubertf # noise $S/KDE_Window_DeIconify.wav 691.3Shubertf mount -u -o atime,devmtime -a 701.3Shubertf atactl wd0 setidle 0 711.1Shubertf ;; 721.1Shubertf 731.1Shubertf*battery) 741.3Shubertf # Running on battery... 751.3Shubertf # noise $S/KDE_Window_DeIconify.wav 761.3Shubertf mount -u -o noatime,nodevmtime -a 771.3Shubertf atactl wd0 setidle 5 781.1Shubertf ;; 791.1Shubertf 801.1Shubertfesac 811.1Shubertf 821.1Shubertfexit 0 83