[K12OSN] Scripters...I need your help! *please?*

Petre Scheie petre at maltzen.net
Thu Nov 18 22:41:35 UTC 2004


Off the top of my head:

!#/bin/bash
for x in `ls /home`; do
echo "Doing $x ..."
mkdir /home/${x}/win-backup
chown ${x}.${x} /home/${x}/win-backup

echo "Copying /opt/samba/profiles/${x}/My\ Documents/ /home/${x}/win-backup"
#cp /opt/samba/profiles/${x}/My\ Documents/ /home/${x}/win-backup

echo "Copying /opt/samba/profiles/${x}/Desktop/ /home/${x}/win-backup"
#cp /opt/samba/profiles/${x}/Desktop/ /home/${x}/win-backup

echo "Copying /opt/samba/profiles/${x}/Favorites/ /home/${x}/win-backup
#cp /opt/samba/profiles/${x}/Favorites/ /home/${x}/win-backup
done


If you copy this to a file, do a chmod +x on the file, and run it, it will tell 
you what it's going to do without actually doing it.  This way you can see if 
you will get what you want.  Assuming it is what you want, remove the # signs in 
front of the cp commands and rerun the script.  HTH

Petre

David Trask wrote:
> Hi all,
> 
> I can do some very basic scripting and I'm learning all the time, but now
> I need something quite quickly.  I hosed my Samba/LDAP server the other
> day...not sure exactly what went wrong, but the rebuild was quite smooth
> and all the data was easy to reinsert.  The only big issue I have is that
> the Windows (Samba) profiles have become a bit corrupted.  (we do roaming
> profiles)  I've found the best way to fix this is to delete the profile
> and let a new one be created from the default on the next log in.  My
> dilemma....I need to copy the data from the users My Documents, Desktop,
> and Favorites directories to another location...preferably a folder in
> their home directory for safekeeping.  
> 
> Here's the layout of what I want to do.....
> 
> I need to create a folder named "win-backup" in each users home directory
> in /home  
> 
> I then need to backup the My\ Documents/ , Desktop, and Favorites
> directory from each users profile located in /opt/samba/profiles 
> (/opt/samba/profiles/username...ex. /opt/samba/profiles/dtrask/) to the
> "win-backup" folder in the same users home dir.  All dirs are owned by the
> user if that makes a difference.  
> That's it!  Then I can wipe the profiles myself and have them recreated. 
> It'll also be a handy script to have on hand to back up peoples stuff once
> in a while to thier home directory.  
> 
> So in outline form...
> 
> for each username...
> 
> mkdir /home/"username"/win-backup
> cp /opt/samba/profiles/"username"/My\ Documents/ Desktop Favorites  to
> /home/"username"/win-backup
> 
> then repeat for next user.....
> 
> Can anyone help?   
> 
> 
> David N. Trask
> Technology Teacher/Coordinator
> Vassalboro Community School
> dtrask at vcs.u52.k12.me.us
> (207)923-3100
> 
> _______________________________________________
> K12OSN mailing list
> K12OSN at redhat.com
> https://www.redhat.com/mailman/listinfo/k12osn
> For more info see <http://www.k12os.org>
> 




More information about the K12OSN mailing list