We are looking to have a script run at logout that rsyncs the data from a Users (AD user) local Documents and Desktop folders to their shared drive that is already mounted on their system. The script that I had gotten working in terminal works well as it rsyncs the data just the one way from the local to the user share. I think though I need to modify it to use the $3 variable so Casper understand to run it on user logout and not system logout as this keeps failing. I may also think about trying to have it rsync the contents of desktop from the share back to the local desktop on login. We are doing this specifically for our elementary school students so its almost like redirection without using redirection lol.
Any help would make me very grateful.
Here is what I got with help from Ben Greisler:
#!/bin/sh
#By Ben Greisler ben@kadimac.com July 23, 2012
klistuser=whoami
#echo $klistuser
pathb=$(echo `dscl localhost -read /Search/Users/$klistuser dsAttrTypeStandard:OriginalHomeDirectory` | awk 'BEGIN { FS = ".internal" }; { print $2 }' | awk 'BEGIN { FS = "<path>" }; { print $1 }' | awk '{ sub("</url>","");print}')
#echo $pathb
localpath=/Users/$klistuser
#echo $localpath
rsync -avz $localpath/Desktop/ /Volumes/$pathb/Desktop/
rsync -avz $localpath/Documents/ /Volumes/$pathb/Documents/