Home | History | Annotate | Line # | Download | only in apm
script revision 1.1.2.1
      1      1.1  hubertf #!/bin/sh
      2      1.1  hubertf #
      3  1.1.2.1  minoura # $NetBSD: script,v 1.1.2.1 2000/06/22 16:16:55 minoura 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.1.2.1  minoura # network card:
     10  1.1.2.1  minoura #
     11  1.1.2.1  minoura #   mkdir /etc/apm
     12  1.1.2.1  minoura #   cp script /etc/apm/suspend
     13  1.1.2.1  minoura #   cd /etc/apm
     14  1.1.2.1  minoura #   for i in standby resume line battery ; do ln suspend $i ; done
     15  1.1.2.1  minoura #
     16  1.1.2.1  minoura # 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.1.2.1  minoura noise() {
     31  1.1.2.1  minoura 	audioplay -q -f -s 22050 -c 1 $1
     32  1.1.2.1  minoura }
     33  1.1.2.1  minoura 
     34      1.1  hubertf case $0 in
     35      1.1  hubertf *suspend)	
     36      1.1  hubertf 	logger 'Suspending...'
     37  1.1.2.1  minoura 	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.1.2.1  minoura 	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.1.2.1  minoura 	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.1.2.1  minoura 	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.1.2.1  minoura 	noise $S/KDE_Startup.wav
     60  1.1.2.1  minoura 	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.1.2.1  minoura 	# Running on power line, not battery...
     68  1.1.2.1  minoura 	# noise $S/KDE_Window_DeIconify.wav
     69  1.1.2.1  minoura 	mount -u -o atime,devmtime -a
     70  1.1.2.1  minoura 	atactl wd0 setidle 0
     71      1.1  hubertf 	;;
     72      1.1  hubertf 
     73      1.1  hubertf *battery)
     74  1.1.2.1  minoura 	# Running on battery...
     75  1.1.2.1  minoura 	# noise $S/KDE_Window_DeIconify.wav
     76  1.1.2.1  minoura 	mount -u -o noatime,nodevmtime -a
     77  1.1.2.1  minoura 	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