#!/bin/bash
#Logout Script V 1.0
#Checks to see if Users Profile space is Still mounted
#Then if the size isn't crazy rsyncs the data back, hopefully
#Oh and it tries to look pretty so the user doesn't get bored.
PATH=/bin:/usr/bin
(
mount |grep /mnt/profile/$USER>/dev/null
mount_test=$?
if [ $mount_test = "0" ]; then
echo "10" ; sleep 1
echo "# Checking Profile Usage"
profile_size=`du -skx --exclude=N /home/$USER | awk '{print $1}'`
if [ $profile_size -lt 25000 ]; then
echo "30"; sleep 1
echo "# Copying Profile Settings"
# rsync, although it conserves bandwidth is unfortunately too slow as it # takes too much time making checksums for the files
#rsync -rpqgo --exclude=.Xauth* --exclude=N --exclude=tmp -W --block-size=300 /home/$USER/ /mnt/profile/$USER/Linux
# clear .Xauthority and .xession-errors
rm -f /home/$USER/.Xauthority /home/$USER/.xsession-errors
mkdir /mnt/profile/$USER/Linux
chown $USER.$USER /mnt/profile/$USER/Linux
cd /home/$USER
cp -f -R -d -u $(/bin/ls -A /home/$USER | sed '/tmp/d' | sed '/N/d') /mnt/profile/$USER/Linux
else
killall zenity
zenity --error --text="Warning You have exceeded your profile quota. Your saved Linux profile will not be copied to the network. Your data will remain on the Linxus server for 72 hours. Log back in and save the data to your network share /home/$USER/N and delete any large files in the root directory /home/$USER."
exit 0
fi
else
killall zenity
zenity --error --text="Your profile does not seem to be mounted, please contact the administrator or your local consulting office for more information."
e
fi
echo "70"
echo "# Finishing logout"
echo "80"
echo "90"; sleep 1
echo "100"
) |
zenity --progress --pulsate --auto-close --title="Logging Out" --text="Checking Mount Points ..." --percentage=0
#Possible error Dialog if user is dumb and tries to cancel...
if [ "$?" != 0 ]; then
zenity --error --text="Update cancelled. Settings Not Saved. Please contact your local consulting office for further help"
exit 1
exit 0
I made a small change to the login script. When checking the profile size of the user's home directory the N directory should be omitted since this is part of the users 50 MB. I excluded that directory and it sped up the logout process a bit. It currently seems to spend most of the logout process rsyncing the profile. In the end I've removed rsync and the script instead copies the data that has been updated over. The algorithm used by rsync greatly reduces network bandwidth by only transmitting the deltas of the file. However, this is extremely slow when dealing with a few hundred configuration files.
--
DavidCollie Sep 24 2004