I'm not sure how to write this script and was hoping someone would help me out, it is for Mac OS 10.3 and the macs are binding to Active Directory for Authentication. The shell by default is bash now when running 10.3.
When you log into a Mac it automatically creates a Home Directory for the user from the OS X user Home Directory Template and names the home directory the same as the users username. So if Joe User has a user name of userj and he logs in he gets a home directory of userj.
Here is what I would like to do:
When a user logs out I want a shell script to kick off moving the users home directory to /tmp. But if that user logs in again and out I need the script to add a digit or something on the end so it doesn't error out or overwrite the home directory from before.
One problem I am having is in /Users I don't want the Admin home folder deleted or a directory called shared deleted or moved.
User Home Directory: /Users/ the users AD username
Temporary Storage: /tmp
Can someone help me out? I have looked all over and tried writing it myself but I am not sure how to add a digit or something to the end so it doesn't error out or overwrite the home directory already in /tmp. Plus I'm not sure how to identify all the users and not delete the admin or shared directories in /Users.