Home › Forums › Older Versions of Mac OS X and iOS › Mac OS X Server 10.3 › General Discussion › Logoutscript question
- This topic has 1 reply, 1 voice, and was last updated 22 years ago by
andyinindy.
-
AuthorPosts
-
October 18, 2004 at 9:01 pm #359572
andyinindy
ParticipantGroup:
I use a modified version of Bombich’s logout script to manage home folders on my lab machines. Lately I have noticed that user folders are not being archived at logout. In other words, the script does not appear to be executing under certain circumstances (which I cannot replicate).
Here is my script:
—————————————————————————-
#!/bin/bash
uid=”$USER”
home=”/Users/$uid”
time=`date ”+%m-%d-%y_%H.%M.%S”`if [ “$uid” = “infores” ]; then
rm -f /Library/Classic/Classic.dmg.shadow
exit 0
else
echo “Refreshing home directory.”
rm -f /Classic.dmg.shadow
mkdir -m 755 “/private/tmp/$uid.$time”
mv $home “/private/tmp/$uid.$time”fi
rm -f /Library/Classic/Classic.dmg.shadow
exit 0
—————————————————————————-
“infores” is a local admin account, so I don’t want to remove it.
The file is owned by root, group is wheel, permissions are rwx-r-x-r-x. It lives in /private/var/root/Scripts. Loginwindow.plist is modified accordingly.
Again, this works properly in almost all cases. However, it sometimes inexplicably refuses to run!
Any advice appreciated!
–Andy
October 22, 2004 at 1:20 pm #359631andyinindy
ParticipantMacTroll:
Thanks for the reply.
After further testing, the script, although unnecessarily complex, works fine. The problem was with the com.apple.loginwindow.plist file. For some reason it had become corrupted, and the LogoutScript portion was missing!
Any idea as to why this preference file gets borked occasionally? I’m beginning to think that I should be using Radmind or something similar to ensure that these crucial files do not get screwed up…
For those who are interested, here’s how I simplified my script:
#!/bin/bash uid="$USER" home="/Users/$uid" time=`date ''+%m-%d-%y_%H.%M.%S''` if [ "$uid" != "infores" ]; then rm -f /Library/Classic/Classic.dmg.shadow mkdir -m 755 "/private/tmp/$uid.$time" mv $home "/private/tmp/$uid.$time" fi exit 0
-
AuthorPosts
- You must be logged in to reply to this topic.