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