I have a situation where I need every G4 (around 200) on my network to "Do a little housecleaning" upon login. I have been refered to Apple's site and found that LoginHooks will do exactly what I want it to do, with the least intrusion to the user machine. I read up on how to implement these and thought it would be pretty straight forward.
I modified line in the ttys file from:
console "/System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow" vt100 on secure window=/System/Library/CoreServices/WindowServer onoption="/usr/libexec/getty std.9600"
console "/System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow -LoginHook /Users/admin/Scripts/cleanDT" vt100 on secure window=/System/Library/CoreServices/WindowServer onoption="/usr/libexec/getty std.9600"
where cleanDT is a script that is executable. A very simple one line script to remove a file called errorlog.txt.
Here is the script I used:
It works great if I'm in the scripts folder and issue ./cleanDT command. Boom the file is gone. But when I modify the line in ttys, upon reboot I get to the login window, enter name and password and the screen flickers abit a goes right back to the login window. Is there something blindingly obvious that I have wrong here.
Thanks for any help!!
Are you sure the cleanDT script executable?
chmod +x /Users/admin/Scripts/cleanDT
Is that path readable or have you made your permissions more restrictive than the defaults?
Have you tried it as just a #!/bin/sh script, rather than zsh?
And does the target file of the rm have a sticky bit or is it root owned, or some other permissions setting that may prevent your hook from working?