looking for pointers groking ldm/rc.d scripts
lists.john at gmail.com
Sun Feb 15 02:44:30 UTC 2009
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.
# 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
# Name of ZDrive on Desktop
# If the user created files in the home directory, rsync them
# to their Zdrive and remove the copy
for src in "$HOME" "$dt"
# Walk entries in this dir
for x in *
# Only process *files* in this dir
if [ -f "$x" ]
# Calculate default destination
if [ -e "$dest" ]
rsync -avu "$x" "$dest"
rm -rf "$x"
cp "$x" "$dest" && rm -f "$x"
More information about the edubuntu-devel