Home | History | Annotate | Line # | Download | only in apm
script revision 1.2
      1  1.1   hubertf #!/bin/sh
      2  1.1   hubertf #
      3  1.2  gmcgarry # $NetBSD: script,v 1.2 2000/06/01 21:54:54 gmcgarry 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   hubertf # network card. See apmd(8) for more information.
     10  1.1   hubertf #
     11  1.1   hubertf 
     12  1.1   hubertf 
     13  1.1   hubertf PATH=/usr/pkg/bin:/sbin:$PATH
     14  1.1   hubertf export PATH
     15  1.1   hubertf 
     16  1.1   hubertf # Where some sound files are stored:
     17  1.1   hubertf S=/usr/X11R6/share/kde/sounds
     18  1.1   hubertf 
     19  1.1   hubertf # What my network card's recognized as:
     20  1.1   hubertf if=ne0
     21  1.1   hubertf 
     22  1.1   hubertf 
     23  1.1   hubertf case $0 in
     24  1.1   hubertf *suspend)	
     25  1.1   hubertf 	logger 'Suspending...'
     26  1.2  gmcgarry 	audioplay -q -f -s 22050 -c 1 $S/KDE_Window_UnMaximize.wav
     27  1.1   hubertf 	# In case some NFS mounts still exist - we don't want them to hang:
     28  1.1   hubertf 	umount -a    -t nfs
     29  1.1   hubertf 	umount -a -f -t nfs
     30  1.1   hubertf 	ifconfig $if down
     31  1.1   hubertf 	kill `ps -auxwww | grep dhclient | awk '{print $2}'`
     32  1.1   hubertf 	logger 'Suspending done.'
     33  1.1   hubertf 	;;
     34  1.1   hubertf 
     35  1.1   hubertf *standby)
     36  1.1   hubertf 	logger 'Going to standby mode ....'
     37  1.2  gmcgarry 	audioplay -q -f -s 22050 -c 1 $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   hubertf 	kill `ps -auxwww | grep dhclient | awk '{print $2}'`
     43  1.1   hubertf 	logger 'Standby done.'
     44  1.1   hubertf 	;;
     45  1.1   hubertf 
     46  1.1   hubertf *resume)
     47  1.1   hubertf 	logger Resuming...
     48  1.2  gmcgarry 	audioplay -q -f -s 22050 $S/KDE_Startup.wav
     49  1.1   hubertf 	dhclient $if
     50  1.1   hubertf 	# mount /home
     51  1.1   hubertf 	# mount /data
     52  1.1   hubertf 	logger 'Resuming done.'
     53  1.1   hubertf 	;;
     54  1.1   hubertf 
     55  1.1   hubertf *line)
     56  1.2  gmcgarry 	# audioplay -q -f -s 22050 -c 1 $S/KDE_Window_DeIconify.wav
     57  1.1   hubertf 	;;
     58  1.1   hubertf 
     59  1.1   hubertf *battery)
     60  1.2  gmcgarry 	# audioplay -q -f -s 22050 -c 1 $S/KDE_Window_DeIconify.wav
     61  1.1   hubertf 	;;
     62  1.1   hubertf 
     63  1.1   hubertf esac
     64  1.1   hubertf 
     65  1.1   hubertf exit 0
     66