looking for pointers groking ldm/rc.d scripts

john lists.john at gmail.com
Sun Feb 15 02:44:30 GMT 2009


Hello all,

I am trying to craft a script that moves files from users Desktops to
a network share which is mounted via NFS. I currently run this script
successfully at logon under Ubuntu Hardy 8.04 AMD 64. My clients are
built with the -ai386 option so they run in 32 bit mode. The working
verison of the script is sourced from /etc/X11/Xsession.d

However I'd rather have this script run at log off, and I understand
that I need to run it from /opt/ltsp/i386/usr/lib/ldm/rc.d

I've created a file called K99-CleanDesktop and I've re-rolled my
client image. But my script doesn't appear to run on logoff. I suspect
it's because I don't understand how to adapt this script correctly.
I've tried to grok section 15.5 from the LTSP Admin Manual
www.ltsp.org/~sbalneav/LTSPManual.pdf but I am sorry to say it's just
too terse for me to understand.

I've pasted my script below with the hope that someone can tutor me
and help me get this working.

Thanks!!

John







# K99-CleanDesktop
#       Clean up from previous session
#
# Sweep all files from $HOME and $HOME/Desktop to $HOME/Desktop/ZDrive
#  (ignores directories).
# Makes Desktop and ZDrive dir entries if needed.
#



# Name of desktop itself
dt=$HOME/Desktop

# Name of ZDrive on Desktop
zd=$dt/ZDrive

# If the user created files in the home directory, rsync them
# to their Zdrive and remove the copy
for src in "$HOME" "$dt"
do
   # Walk entries in this dir
   cd $src
   for x in *
   do
       # Only process *files* in this dir
       if [ -f "$x" ]
       then
           # Calculate default destination
           dest="$zd/$x"

           if [ -e "$dest" ]
           then
               rsync -avu "$x" "$dest"
               rm -rf "$x"
           else
               cp "$x" "$dest" && rm -f "$x"
           fi
       fi
   done
done



More information about the edubuntu-users mailing list