How do I run a script at logout?

Discussion in 'macOS' started by lancestraz, Jun 18, 2007.

  1. lancestraz macrumors 6502a

    lancestraz

    Joined:
    Nov 27, 2005
    Location:
    RI
    #1
    When I logout or restart while I am connected to a networked drive, my computer freezes.

    I know how write an AppleScript to unmount the drives, but how do I make it run when I logout?
     
  2. Lixivial macrumors 6502a

    Lixivial

    Joined:
    Jan 13, 2005
    Location:
    Between cats, dogs and wanderlust.
    #2
    If you're still looking for this information, you'll want to peruse the documentation at Apple (or a more PR friendly version). Or just Google for LoginHook or LogoutHook -- you should get some pretty good hits on the subject.

    LoginHook can be replaced with LogoutHook in that documentation, and it works best with a shell script -- but that's OK because the command osascript will run AppleScripts from CLI/Scripts.
     
  3. andrewag macrumors 6502

    Joined:
    Jan 11, 2005
    Location:
    Australia

Share This Page