On Fri, May 28, 2010 at 03:56:00PM +0200, Matteo Sgalaberni wrote:
> Hi,
>
> do you know if there are ways to restore file attributes (uid/gid,
> permissions) fetching file attributes from BackupPC?
I will reply to myself...I hope that this will be useful for someone
else ...
First export a list of the files on the backup:
# /usr/local/BackupPC/bin/BackupPC_tarCreate -h $hostname -n 1 -s "/" -L >
backup.list
it will return in the output file some like this:
100755 0/0 26860 ./bin/cat
100755 0/0 45344 ./bin/chgrp
....
create this script file "parse_perms.py":
#!/usr/bin/python
import sys, re
while 1:
dati = sys.stdin.readline()
if dati == "": break
dati = re.findall("([^ ]+)", dati)
bits = dati[0][-4:]
uidgroup = (dati[1]).replace("/",".")
path = dati[3].replace("\n","")
print "chmod %s %s" % (bits, path)
print "chown %s %s" % (uidgroup, path)
afterthat parse the "backup.list" with that script:
# cat backup.list | python parse_perms.py > commands.sh
now in commands.sh you will have all chmod/chown commands ready to be executed
on the target server and restore all permissions as was on the backup snapshot.
M.
------------------------------------------------------------------------------
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List: https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki: http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/
|