home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Utilities / LogHooks-1.0-MIHS / Logout.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1997-02-19  |  702 b   |  42 lines

  1. #!/bin/sh 
  2. #
  3. # Version 1.0
  4. # 19 Feb 1997
  5. # TjL <luomat@peak.org>
  6. #
  7. # This file should be saved as ~/.LogoutHook to make it work
  8. # Use at your own risk
  9. #
  10. # You'll need the "Alert" binary from the ShellPanel package available
  11. # on the FTP sites.
  12.  
  13. /usr/local/bin/Alert "Empty Recycler?" Yes No
  14.  
  15. if [ $? = 0 ]
  16. then
  17.     # Empty Recycler but do not delete folder
  18.     /bin/rm -rf $HOME/.NeXT/.NextTrash/* 
  19. fi
  20.  
  21. /usr/local/bin/Alert "Reboot?" "Don't Reboot" "Reboot" "Power off"
  22.  
  23. exitcode="$?"
  24.  
  25.  
  26. if [ "$exitcode" = "2" ]
  27. then
  28.     # power off -- this must be run as root
  29.     /usr/etc/shutdown -h -p +1
  30.  
  31. elif [ "$exitcode" = "1" ]
  32. then
  33.     # reboot -- this must be run as root
  34.     /usr/etc/shutdown -r +1
  35.  
  36. else
  37.     exit 0
  38. fi
  39.  
  40.  
  41. exit 0
  42.