You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-11-06 08:49:29 +02:00
Added warnings, comments, removed dead code.
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/perl
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
#use Getopt::Long;
|
||||
|
||||
#my $strCommandCompress = "pigz --rsyncable --best --stdout %file%"; # Ubuntu Linux
|
||||
my $strCommandCompress = "gzip --stdout %file%"; # Ubuntu Linux
|
||||
my $strCommandCompress = "gzip --stdout %file%"; # OSX
|
||||
#my $strCommandHash = "sha1sum %file% | awk '{print \$1}'"; # Ubuntu Linux
|
||||
my $strCommandHash = "shasum %file% | awk '{print \$1}'";
|
||||
my $strCommandHash = "shasum %file% | awk '{print \$1}'"; # OSX
|
||||
|
||||
################################################################################
|
||||
# EXECUTE A COMMAND
|
||||
@@ -15,8 +15,6 @@ sub execute
|
||||
{
|
||||
my $strCommand = shift;
|
||||
|
||||
#local($strCommand) = @_;
|
||||
|
||||
# print("$strCommand\n");
|
||||
my $strOutput = qx($strCommand) or return 0;
|
||||
# print("$strOutput\n");
|
||||
@@ -30,7 +28,6 @@ sub execute
|
||||
sub file_hash_get
|
||||
{
|
||||
my $strFile = shift;
|
||||
#local($strFile) = @_;
|
||||
|
||||
my $strCommand = $strCommandHash;
|
||||
$strCommand =~ s/\%file\%/$strFile/g;
|
||||
@@ -52,12 +49,24 @@ my $strCommand = $ARGV[0];
|
||||
################################################################################
|
||||
if ($strCommand eq "archive-local")
|
||||
{
|
||||
# Get the source dir/file
|
||||
my $strSource = $ARGV[1];
|
||||
|
||||
# !!! Make sure this is defined
|
||||
# !!! Make sure that the file exists
|
||||
|
||||
# Get the destination dir/file
|
||||
my $strDestination = $ARGV[2];
|
||||
|
||||
# !!! Make sure this is defined
|
||||
# !!! Make sure that the destination dir exists
|
||||
|
||||
# Calculate sha1 hash for the file
|
||||
my $strHash = file_hash_get($strSource);
|
||||
|
||||
|
||||
# !!! Make sure the file does not already exist!
|
||||
# !!! check only the prefix - not with the checksum in case it changed "file-*.gz"
|
||||
|
||||
# Setup the compression string
|
||||
my $strCommand = $strCommandCompress;
|
||||
$strCommand =~ s/\%file\%/$strSource/g;
|
||||
|
||||
Reference in New Issue
Block a user