log-out script

Discussion in 'Mac OS X Server, Xserve, and Networking' started by olej, Jul 28, 2010.

  1. macrumors newbie

    Joined:
    Mar 7, 2009
    #1
    Hi,

    Where I should insert log-out script in mac os 10.5 ?

    I would like control which time users login to computer and which time log out.

    I made login script:

    #!/bin/sh
    mkdir /Volumes/log
    mount_smbfs '//@svbk/LOG$' /Volumes/log
    echo "$(date "+%Y-%m-%d, %T"), $(users), LOG-IN" >> /Volumes/log/logmac.rtf
    umount /Volumes/log
    killall Terminal

    and logout script:
    #!/bin/sh
    mkdir /Volumes/log
    mount_smbfs '//@svbk/LOG$' /Volumes/log
    echo "$(date "+%Y-%m-%d, %T"), $(users), LOG-OUT" >> /Volumes/log/logmac.rtf
    umount /Volumes/log
    killall Terminal

    but I don't now where I should insert logout script.
    may somebody have a better idea to control time login,logout ?

    Thx for help!!!
     
  2. macrumors 68040

    calderone

    Joined:
    Aug 28, 2009
    Location:
    Seattle
    #2
    You can do this with hooks.

    Code:
    defaults write com.apple.loginwindow LoginHook /path/to/script.sh
    Code:
    defaults write com.apple.loginwindow LogoutHook /path/to/script.sh
    This requires elevated rights, so you will need to pop a sudo in front of those.

    Done.
     

Share This Page