diff --git a/pull/pull b/pull/pull index 9494dd8..d1367bb 100755 --- a/pull/pull +++ b/pull/pull @@ -535,7 +535,11 @@ provider_pull_pantheon_db () local last_backup last_backup=$(_exec -T "terminus backup:list ${hostingsite}.${hostingenv} --element=db --format=list --field=date | head -n 1") if_failed_error "Error retrieving list of backups from Pantheon for ${hostingsite} on the ${hostingenv} environment" - if [[ "last_backup" == "" ]] || [[ "${last_backup}" < "${yesterday}" ]] || [[ "$force" == "force" ]]; then + if [[ "${last_backup}" != "" ]]; then + # terminus returns a raw epoch timestamp; convert to the same "Y-m-d H:M:S" format as $yesterday so the comparison below is meaningful. + last_backup=$(_exec date --date="@${last_backup%%.*}" "+%Y-%m-%d %H:%M:%S") + fi + if [[ "${last_backup}" == "" ]] || [[ "${last_backup}" < "${yesterday}" ]] || [[ "$force" == "force" ]]; then # If last backup does not exist or is older than 24 hours create new one. echo -e "${acqua}Creating new backup on Pantheon for ${hostingsite} on the ${hostingenv} environment${NC}" _exec terminus backup:create ${hostingsite}.${hostingenv} --element=db