Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

olej

macrumors newbie
Original poster
Mar 7, 2009
3
0
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!!!
 

calderone

Cancelled
Aug 28, 2009
3,743
352
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.