X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=bin%2FBackupPC_incPartsUpdate;h=7f7313cd4f2c3fae097851e258eb0438ccee8b7f;hb=c2bfdee61fbf96c5fd286b2fe810b138128b5877;hp=3971f7e09f48edaa76252cfcc6125327b734971b;hpb=b831beaa8b6d40bf9c261cac8b5a2b49a214001b;p=BackupPC.git diff --git a/bin/BackupPC_incPartsUpdate b/bin/BackupPC_incPartsUpdate index 3971f7e..7f7313c 100755 --- a/bin/BackupPC_incPartsUpdate +++ b/bin/BackupPC_incPartsUpdate @@ -16,6 +16,24 @@ use Archive::Tar::Streamed; use Algorithm::Diff; use Getopt::Std; use File::Slurp; +use File::Pid; + +my $pid_path = abs_path($0); +$pid_path =~ s/\W+/_/g; + +my $pidfile = new File::Pid({ + file => "/tmp/$pid_path", +}); + +if (my $pid = $pidfile->running ) { + die "$0 already running: $pid\n"; +} elsif ($pidfile->pid ne $$) { + $pidfile->remove; + $pidfile = new File::Pid; +} + +print STDERR "$0 using pid ",$pidfile->pid," file ",$pidfile->file,"\n"; +$pidfile->write; my $bpc = BackupPC::Lib->new || die "can't create BackupPC::Lib"; my %Conf = $bpc->Conf(); @@ -245,7 +263,7 @@ sub tar_check($$$$) { # real tar size is bigger because of padding if ($tar_size_inarc > $tar_size) { - print ", size of files in tar bigger than whole tar!\n"; + print ", size of files in tar ($tar_size_inarc) bigger than whole tar ($tar_size)!\n"; return 0; }