Hi,
ich packe mit
tar --listed-incremental=history.tar -cvf - /home/test | $gzip -9 - tar.`date +%s`
ein Homeverzeichnis.
Angenommen ich habe jetzt ausgehend von einem Vollbackup noch darauf aufbauend 3 weitere inc. Backups. Wie kann ich aus den tar Archiven eine Auflistung aller Dateien erstellen, die nach dem Zurückspielen bis zum einschliesslich 2. Backup im Homeverzeichnis vorhanden wären? Das Ganze ohen die Archive zu entpacken!
tar und alle Dateien eines Incrementellen Backups
-
- Posts: 1117
- Joined: 2002-09-27 00:54
- Location: Hannover
-
- Project Manager
- Posts: 11186
- Joined: 2003-02-27 01:00
- Location: Hamburg
Re: tar und alle Dateien eines Incrementellen Backups
Ungetestet:
Code: Select all
{ for file in ./*.tar; do tar -t $file; done } | sort -u
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
-
- Posts: 1117
- Joined: 2002-09-27 00:54
- Location: Hannover
Re: tar und alle Dateien eines Incrementellen Backups
Es werden dann aber auch alle Dateien aufgelistet, die im Homeverzeichnis gelöscht wurden.
-
- Project Manager
- Posts: 11186
- Joined: 2003-02-27 01:00
- Location: Hamburg
Re: tar und alle Dateien eines Incrementellen Backups
Da helfen Dir tar -d und grep/sed weiter.
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
-
- Posts: 1117
- Joined: 2002-09-27 00:54
- Location: Hannover
Re: tar und alle Dateien eines Incrementellen Backups
Wobei mir -d auch nicht hilft, wenn ich das Ganze nicht auf dem Rechner mache, auf dem das Backup auch gelaufen ist...
-
- Project Manager
- Posts: 11186
- Joined: 2003-02-27 01:00
- Location: Hamburg
Re: tar und alle Dateien eines Incrementellen Backups
Du kannst tar -d auch direkt vor dem Backup ausführen und die Ausgabe per Pipe in einer Textdatei speichern und später per grep/sed/perl/etc... auswerten.
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
-
- Posts: 1117
- Joined: 2002-09-27 00:54
- Location: Hannover
Re: tar und alle Dateien eines Incrementellen Backups
Leider muss es für Backup funktionieren, die schon bestehen.
Meine Lösung jetzt:
Meine Lösung jetzt:
Code: Select all
sub filelist {
#
# Create a filelist from an archiv
#
my $tar = $system::config{backup_tar};
my $gunzip = $system::config{backup_gunzip};
my $answer = "";
my ($d,$userid,$ftp_uid,$ftp_pwd,$ftp_srv,$ftp_dir,$id,$ftp_file) = split(/:/,$_[0]);
if ($userid and $ftp_uid and $ftp_pwd and $ftp_srv and $ftp_dir and $ftp_file) {
$answer .= "USERID: $useridn";
my $ftp = modules::backup::ftp_connect($ftp_uid,$ftp_pwd,$ftp_srv,$ftp_dir);
if ($ftp) {
open(PIPE,"| $gunzip - - 2>/dev/null | $tar --listed-incremental=/dev/zero -tv > /tmp/ftp_files.$$");
$ftp->get("$ftp_dir/$ftp_file",*PIPE);
close(PIPE);
$ftp->quit;
my $dir = undef;
open(FILE,"</tmp/ftp_files.$$");
while(<FILE>) {
#
# Read data from file
#
chomp($tmp = $_);
if ($tmp =~ //) {
#
# File information
#
my @files = split(//,$tmp);
foreach my $file (@files) {
$type = substr($file,0,1);
$file = substr($file,1,length($file)-1);
$answer .= "FILE: $id: $type: $dir$filen";
}
} else {
#
# Dir information
#
$dir = "/home/".(split(/ home//,$tmp))[1];
}
}
close(FILE);
unlink "/tmp/ftp_files.$$";
}
}
return $answer;
}