Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions backup-manager-purge
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ sub parse_archive ($)
my ($prefix, $name, $date, $master, $filetype);
$archive = basename ($archive);

if ($archive =~ m/^\s*($ENV{BM_ARCHIVE_PREFIX})-?(\S+)?\.?(\d{8})\.(master\.)?(\S+)\s*$/) {
if ($archive =~ m/^\s*($ENV{BM_ARCHIVE_PREFIX})-?(\S+)?\.?(\d{14})\.(master\.)?(\S+)\s*$/) {
($prefix, $name, $date, $master, $filetype) = ($1, $2, $3, $4, $5);
$master = $master ? 1 : 0;
$name = "$prefix-md5" if $filetype eq 'md5' and not $name;
}

# The archive pattern
elsif ($archive =~ /^\s*([^-]+)-(\S+)\.(\d{8})\.(\S+)\s*$/) {
elsif ($archive =~ /^\s*([^-]+)-(\S+)\.(\d{14})\.(\S+)\s*$/) {
$prefix = $1;
$name = $2;
$date = $3;
Expand All @@ -169,7 +169,7 @@ sub parse_archive ($)
}

# The md5 file pattern
elsif ($archive =~ /^\s*([^-]+)-(\d{8})\.md5\s*$/) {
elsif ($archive =~ /^\s*([^-]+)-(\d{14})\.md5\s*$/) {
$prefix = $1;
$name = "$prefix-md5";
$date = $2;
Expand Down Expand Up @@ -238,7 +238,7 @@ sub outdate_archives($$)
exit E_INTERNAL;
}

my $purge_date = strftime ('%Y%m%d',
my $purge_date = strftime ('%Y%m%d%H%M%S',
localtime(time() - $g_ttl * 24 * 3600));
print_info "Outdating archives made before $purge_date";

Expand Down
6 changes: 3 additions & 3 deletions backup-manager-upload
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ sub get_formated_date($)
}

if ($date eq 'today') {
return strftime ('%Y%m%d', localtime);
return strftime ('%Y%m%d%H%M%S', localtime);
}
elsif ($date eq 'yesterday') {
return strftime ('%Y%m%d', localtime(time - (24 * 3600)));
return strftime ('%Y%m%d%H%M%S', localtime(time - (24 * 3600)));
}
elsif ($date =~ /^\d{4}\d{2}\d{2}$/) {
elsif ($date =~ /^\d{4}\d{2}\d{2}\d{2}\d{2}\d{2}$/) {
return $date;
}
else {
Expand Down
2 changes: 1 addition & 1 deletion lib/actions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function bm_init_env ()
function bm_init_today()
{
debug "bm_init_today()"
export TODAY=`date +%Y%m%d`
export TODAY=`date +%Y%m%d%H%M%S`
}

# be sure that zip is supported.
Expand Down
2 changes: 1 addition & 1 deletion lib/files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ function get_date_from_archive()
file="$1"
debug "get_date_from_archive ($file)"

date=$(echo $file | sed -e 's/.*\(20[0-9][0-9][0-9][0-9][0-3][0-9]\).*/\1/')
date=$(echo $file | sed -e 's/.*\(20[0-9][0-9][0-9][0-9][0-3][0-9][0-2][0-9][0-5][0-9][0-5][0-9]\).*/\1/')
echo "$date"
}

Expand Down