[K12OSN] Scripters...I need your help! *please?*
Christopher K. Johnson
ckjohnson at gwi.net
Thu Nov 18 22:58:10 UTC 2004
Petre Scheie wrote:
> 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 -a /opt/samba/profiles/${x}/My\ Documents/ /home/${x}/win-backup
>
> echo "Copying /opt/samba/profiles/${x}/Desktop/ /home/${x}/win-backup"
> #cp -a /opt/samba/profiles/${x}/Desktop/ /home/${x}/win-backup
>
> echo "Copying /opt/samba/profiles/${x}/Favorites/ /home/${x}/win-backup
> #cp -a /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
I inserted "-a" option on cp to recursively copy everything and preserve
ownership.
Be aware that when used repeatedly the results will include the
aggregate of all files of different names which were once present when
backed up. In other words files removed between backups from under
/opt/samba/profiles/... will still exist under the win-backup directories.
You may want to configure rsync instead of cp for future use. But
Petre's solution is a quick and effective one for now.
Chris
--
-----------------------------------------------------------
"Spend less! Do more! Go Open Source..." -- Dirigo.net
Chris Johnson, RHCE #807000448202021
More information about the K12OSN
mailing list