1 #!/bin/sh 2 # 3 # $NetBSD: script,v 1.3 2000/06/18 16:16:34 hubertf Exp $ 4 # 5 6 # 7 # Link this script to /etc/apm/{suspend,standby,resume,line,battery} 8 # to play some sounds on suspend/resume, and enable/shutdown the 9 # network card: 10 # 11 # mkdir /etc/apm 12 # cp script /etc/apm/suspend 13 # cd /etc/apm 14 # for i in standby resume line battery ; do ln suspend $i ; done 15 # 16 # See apmd(8) for more information. 17 # 18 19 20 PATH=/usr/pkg/bin:/sbin:$PATH 21 export PATH 22 23 # Where some sound files are stored: 24 S=/usr/X11R6/share/kde/sounds 25 26 # What my network card's recognized as: 27 if=ne0 28 29 30 noise() { 31 audioplay -q -f -s 22050 -c 1 $1 32 } 33 34 case $0 in 35 *suspend) 36 logger 'Suspending...' 37 noise $S/KDE_Window_UnMaximize.wav 38 # In case some NFS mounts still exist - we don't want them to hang: 39 umount -a -t nfs 40 umount -a -f -t nfs 41 ifconfig $if down 42 sh /etc/rc.d/dhclient stop 43 logger 'Suspending done.' 44 ;; 45 46 *standby) 47 logger 'Going to standby mode ....' 48 noise $S/KDE_Window_UnMaximize.wav 49 # In case some NFS mounts still exist - we don't want them to hang: 50 umount -a -t nfs 51 umount -a -f -t nfs 52 ifconfig $if down 53 sh /etc/rc.d/dhclient stop 54 logger 'Standby done.' 55 ;; 56 57 *resume) 58 logger Resuming... 59 noise $S/KDE_Startup.wav 60 sh /etc/rc.d/dhclient start 61 # mount /home 62 # mount /data 63 logger 'Resuming done.' 64 ;; 65 66 *line) 67 # Running on power line, not battery... 68 # noise $S/KDE_Window_DeIconify.wav 69 mount -u -o atime,devmtime -a 70 atactl wd0 setidle 0 71 ;; 72 73 *battery) 74 # Running on battery... 75 # noise $S/KDE_Window_DeIconify.wav 76 mount -u -o noatime,nodevmtime -a 77 atactl wd0 setidle 5 78 ;; 79 80 esac 81 82 exit 0 83