From 3c27d55ddd918352fdca4ce3b606ebab1f0b33a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Elliott=20B=C3=A9cue?= Date: Tue, 16 Dec 2014 02:25:32 +0100 Subject: [PATCH] Oublis... --- backups/generate_configs.py | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/backups/generate_configs.py b/backups/generate_configs.py index 9d5ec08d..a285cbdc 100755 --- a/backups/generate_configs.py +++ b/backups/generate_configs.py @@ -35,12 +35,12 @@ if __name__ == "__main__": backup_folders.pop(excluded) with open(rootpath + hoteRsync + ".pl", "w") as fichier: fichier.write("""$Conf{RsyncShareName} = ['%(shares)s']; - $Conf{BackupFilesExclude} = { - %(excludes)s - }; +$Conf{BackupFilesExclude} = { + %(excludes)s +}; - $Conf{IncrPeriod} = %(incr)s; - $Conf{FullPeriod} = %(full)s;""" % {'shares' : "', '".join(backup_folders.keys()), 'excludes' : "\n ".join(["'%s' => ['lost+found']," % nom for nom in backup_folders.keys()]), 'incr': backups.RsyncPeriods[hoteRsync][0], 'full': backups.RsyncPeriods[hoteRsync][1]}) +$Conf{IncrPeriod} = %(incr)s; +$Conf{FullPeriod} = %(full)s;""" % {'shares' : "', '".join(backup_folders.keys()), 'excludes' : "\n ".join(["'%s' => ['lost+found']," % nom for nom in backup_folders.keys()]), 'incr': backups.RsyncPeriods[hoteRsync][0], 'full': backups.RsyncPeriods[hoteRsync][1]}) if backups.DumpPreUserCmd[hoteRsync]: fichier.write("""\n$Conf{DumpPreUserCmd} = '%(dp)s';""" % {'dp':backups.DumpPreUserCmd[hoteRsync],}) os.chmod(rootpath + hoteRsync + ".pl", 0644) @@ -50,14 +50,19 @@ if __name__ == "__main__": for homeDir in backups.HomeHosts: with open(rootpath + "home-" + homeDir + ".pl", "w") as fichier: fichier.write("""# Ces fichiers servent à backuper les homes en séparé. - $Conf{ClientTimeout} = 86400; +$Conf{ClientNameAlias} = 'localhost'; +$Conf{XferMethod} = 'tar'; +$Conf{TarShareName} = ['/home/%(share)s']; +$Conf{TarClientCmd} = '/usr/bin/env LC_ALL=C sudo /usr/local/bin/backuppc_tar -v -f - -C $shareName --totals'; - $Conf{XferMethod} = 'tar'; - $Conf{TarShareName} = ['/home/%(share)s']; - $Conf{TarClientPath} = '/usr/bin/env LC_ALL=C sudo /usr/local/bin/backuppc_tar -v -f - -C $shareName'; +$Conf{BackupFilesExclude} = { + '/home/%(share)s' => ['lost+found'], +}; - $Conf{BackupFilesExclude} = { - '/home-adh/%(share)s' => ['lost+found'], - };""" % {'share' : homeDir, 'myip' : backups.ipnfs}) +# remove extra shell escapes ($fileList+ etc.) that are +# needed for remote backups but may break local ones +$Conf{TarFullArgs} = '$fileList'; +$Conf{TarIncrArgs} = '--newer=$incrDate $fileList'; +""" % {'share' : homeDir,}) os.chmod(rootpath + "home-" + homeDir + ".pl", 0644) os.chown(rootpath + "home-" + homeDir + ".pl", root, wwwdata)