Jump to content

Recommended Posts

Posted

Our Macs (10.5) are bound to an AD Server (2003) and OS X Server (10.5).

 

All the home folders are stored on the AD.

 

When a user logs into a Mac the default mac folders aren't created. Is there a way to create or push these folders out, similar to how it would work if the home folders were stored on the OS X Server?

 

Cheers.

Posted (edited)

we use a program called ihook to run login scripts at login with a fancey UI with a progress bar. just set scriptname.ihook to run at login and hey presto.

 

Research Systems Unix Group: iHook

 

 

following code is to give you an idea of 1 of our old login scripts. fairly simple stuff.

note the very useful line to clear printing from previous users incase the printer was out of paper or there was a problem with printing when the last user tried printing etc etc!!! (cancel -a)

 

aim of this was to redirect a few network items to local tmp folder to stop the network drivers being hammered by cache files oh and block users own widget folder to stop them installing widgets.

 

 

 

#!/bin/sh
%WINDOWLEVEL HIGH
echo %UIMODE AUTOCRATIC
%WINDOWLEVEL HIGH
echo %BACKGROUND /path/to/background.png
echo %0
echo %TITLE
echo ' PLEASE WAIT.'
sleep 5
echo %5

echo $CONSOLE_USER 

echo %10
%WINDOWLEVEL HIGH
mkdir ~/library/Widgets/
chmod 777 ~/library/Widgets/
echo %15

rm -r ~/library/Widgets/
mkdir ~/library/Widgets/
chmod 000 ~/library/Widgets/

echo %20

# echo 'setting cache redirect to local drive'
echo ' PLEASE WAIT..'
echo %30
rm -R /tmp/$CONSOLE_USER
rm ~/Library/Caches
mkdir /tmp/$CONSOLE_USER
chown $CONSOLE_USER /tmp/$CONSOLE_USER
chmod 700 /tmp/$CONSOLE_USER
echo %40
echo ' PLEASE WAIT...'

# echo 'Removing Cache Folder from users home folder...'
rm -R ~/Library/Caches

echo %60
echo ' PLEASE WAIT....'

# echo 'Creating alias....'

ln -s /tmp/$CONSOLE_USER ~/Library/Caches
ln -s /tmp/$CONSOLE_USER ~/Library/fonts


echo ' PLEASE WAIT......'
# echo 'SETTING CLICKVIEW REDIRECT'
echo %70


rm -R ~/Documents/ClickView/SchoolBag
rm -R ~/Documents/ClickView/CoverImages
rm -R ~/Documents/ClickView/Files
rm -R ~/Documents/ClickView/DataFiles
rm -R /tmp/clickview/SchoolBag
rm -R /tmp/clickview/Files
rm -R /tmp/clickview/CoverImages
rm -R /tmp/clickview/DataFiles
echo %80

echo ' PLEASE WAIT.......'
mkdir /tmp/clickview
mkdir ~/Documents/ClickView
mkdir /tmp/clickview/SchoolBag
mkdir /tmp/clickview/Files
mkdir /tmp/clickview/CoverImages
mkdir /tmp/clickview/DataFiles

sleep 2
echo ' PLEASE WAIT........'
ln -s /tmp/clickview/SchoolBag ~/Documents/ClickView/SchoolBag
ln -s /tmp/clickview/Files ~/Documents/ClickView/Files
ln -s /tmp/clickview/CoverImages ~/Documents/ClickView/CoverImages
ln -s /tmp/clickview/DataFiles ~/Documents/ClickView/DataFiles
echo %90

sleep 2
echo ' PLEASE WAIT.........'
# echo 'Changing temp tmp privs'
chmod 777 /private/tmp
sleep 2
echo ' PLEASE WAIT..........'
echo %95
# echo 'Changing temp clickview privs'
chmod -R 777 /private/tmp/clickview
sleep 2
echo ' PLEASE WAIT...........'
# echo 'Changing temp clickview ownership'
chown -R $CONSOLE_USER /private/tmp/clickview
sleep 2
cancel -a
echo %100
echo Hi $CONSOLE_USER Printing has been Cleared - Login Complete!
sleep 7
echo %UIMODE NORMAL

exit 0

 

cant remember if i put the sleeps in because of error or i put them in there for my sanity so that i could see the script executing. This is a fairly my old version of the scripts we run so might be some errors or old ways of doing things :p

 

also not sure what will and what wont work in these scripts when storing files on smb

 

Disclaimer: you run these at your own risk!

Edited by gaz350

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...