|
Shell (BASH) script to traverse a complete directory and create a gzipped text file containing permissions and owner information for files and directories in the tree. This script is used in conjunction with restore_permission_tree.pl below to save & restore the permission and owner information.
We use rsync to create backup images of OpenVZ hosts on our servers. Since we rsync to the backup host as a non-root user, it is not possible to store the backup files with the same owner as on the host. Further, since we allow web-access to the backups, we have to alter the permissions on the backed-up files to allow the backup box's web server read them.
Before running our rsync backup, our cron job runs this script as below, saving all permission and owner information.
The cron'd script:
for i in `find /vz/private/* -maxdepth 0 -type d`; do
echo saving permissions tree in $i
cd $i
/vz/private/save_permission_tree.sh .file_permissions.txt.gz
done
|