mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-01-24 11:46:31 +02:00
Fix get time in last second.
This commit is contained in:
parent
558d4a3427
commit
3d4a85fff8
@ -83,3 +83,8 @@ EOF
|
|||||||
# init backup catalog
|
# init backup catalog
|
||||||
init_catalog
|
init_catalog
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_time_last_backup()
|
||||||
|
{
|
||||||
|
pg_arman -B ${BACKUP_PATH} show | tail -n +4 | head -n 1 | awk '{print($1, $2)}'
|
||||||
|
}
|
||||||
|
@ -10,14 +10,14 @@
|
|||||||
init_backup
|
init_backup
|
||||||
echo '###### DELETE COMMAND TEST-0001 ######'
|
echo '###### DELETE COMMAND TEST-0001 ######'
|
||||||
echo '###### delete full backups ######'
|
echo '###### delete full backups ######'
|
||||||
FIRST_BACKUP_DATE=`date +"%Y-%m-%d %H:%M:%S"`
|
|
||||||
pg_arman backup -B ${BACKUP_PATH} -b full -p ${TEST_PGPORT} -d postgres --quiet
|
pg_arman backup -B ${BACKUP_PATH} -b full -p ${TEST_PGPORT} -d postgres --quiet
|
||||||
|
FIRST_BACKUP_DATE=$(get_time_last_backup)
|
||||||
pgbench -p ${TEST_PGPORT} >> ${TEST_BASE}/pgbench.log 2>&1
|
pgbench -p ${TEST_PGPORT} >> ${TEST_BASE}/pgbench.log 2>&1
|
||||||
SECOND_BACKUP_DATE=`date +"%Y-%m-%d %H:%M:%S"`
|
|
||||||
pg_arman backup -B ${BACKUP_PATH} -b full -p ${TEST_PGPORT} -d postgres --quiet
|
pg_arman backup -B ${BACKUP_PATH} -b full -p ${TEST_PGPORT} -d postgres --quiet
|
||||||
|
SECOND_BACKUP_DATE=$(get_time_last_backup)
|
||||||
pgbench -p ${TEST_PGPORT} >> ${TEST_BASE}/pgbench.log 2>&1
|
pgbench -p ${TEST_PGPORT} >> ${TEST_BASE}/pgbench.log 2>&1
|
||||||
THIRD_BACKUP_DATE=`date +"%Y-%m-%d %H:%M:%S"`
|
|
||||||
pg_arman backup -B ${BACKUP_PATH} -b full -p ${TEST_PGPORT} -d postgres --quiet
|
pg_arman backup -B ${BACKUP_PATH} -b full -p ${TEST_PGPORT} -d postgres --quiet
|
||||||
|
THIRD_BACKUP_DATE=$(get_time_last_backup)
|
||||||
pg_arman validate -B ${BACKUP_PATH} --quiet
|
pg_arman validate -B ${BACKUP_PATH} --quiet
|
||||||
|
|
||||||
echo "try to delete the oldest backup"
|
echo "try to delete the oldest backup"
|
||||||
@ -32,18 +32,18 @@ echo "Number of deleted backups should be 1, is it so?: ${NUM_OF_DELETED_BACKUPS
|
|||||||
init_backup
|
init_backup
|
||||||
echo '###### DELETE COMMAND TEST-0002 ######'
|
echo '###### DELETE COMMAND TEST-0002 ######'
|
||||||
echo '###### keep backups which are necessary for recovery ######'
|
echo '###### keep backups which are necessary for recovery ######'
|
||||||
FIRST_BACKUP_DATE=`date +"%Y-%m-%d %H:%M:%S"`
|
|
||||||
pg_arman backup -B ${BACKUP_PATH} -b full -p ${TEST_PGPORT} -d postgres --quiet
|
pg_arman backup -B ${BACKUP_PATH} -b full -p ${TEST_PGPORT} -d postgres --quiet
|
||||||
|
FIRST_BACKUP_DATE=$(get_time_last_backup)
|
||||||
pgbench -p ${TEST_PGPORT} >> ${TEST_BASE}/pgbench.log 2>&1
|
pgbench -p ${TEST_PGPORT} >> ${TEST_BASE}/pgbench.log 2>&1
|
||||||
SECOND_BACKUP_DATE=`date +"%Y-%m-%d %H:%M:%S"`
|
|
||||||
pg_arman backup -B ${BACKUP_PATH} -b full -p ${TEST_PGPORT} -d postgres --quiet
|
pg_arman backup -B ${BACKUP_PATH} -b full -p ${TEST_PGPORT} -d postgres --quiet
|
||||||
|
SECOND_BACKUP_DATE=$(get_time_last_backup)
|
||||||
pg_arman validate -B ${BACKUP_PATH} --quiet
|
pg_arman validate -B ${BACKUP_PATH} --quiet
|
||||||
pgbench -p ${TEST_PGPORT} >> ${TEST_BASE}/pgbench.log 2>&1
|
pgbench -p ${TEST_PGPORT} >> ${TEST_BASE}/pgbench.log 2>&1
|
||||||
THIRD_BACKUP_DATE=`date +"%Y-%m-%d %H:%M:%S"`
|
|
||||||
pg_arman backup -B ${BACKUP_PATH} -b page -p ${TEST_PGPORT} -d postgres --quiet
|
pg_arman backup -B ${BACKUP_PATH} -b page -p ${TEST_PGPORT} -d postgres --quiet
|
||||||
|
THIRD_BACKUP_DATE=$(get_time_last_backup)
|
||||||
pg_arman validate -B ${BACKUP_PATH} --quiet
|
pg_arman validate -B ${BACKUP_PATH} --quiet
|
||||||
FOURTH_BACKUP_DATE=`date +"%Y-%m-%d %H:%M:%S"`
|
|
||||||
pg_arman backup -B ${BACKUP_PATH} -b full -p ${TEST_PGPORT} -d postgres --quiet
|
pg_arman backup -B ${BACKUP_PATH} -b full -p ${TEST_PGPORT} -d postgres --quiet
|
||||||
|
FOURTH_BACKUP_DATE=$(get_time_last_backup)
|
||||||
pg_arman validate -B ${BACKUP_PATH} --quiet
|
pg_arman validate -B ${BACKUP_PATH} --quiet
|
||||||
|
|
||||||
echo "try to delete before third backup"
|
echo "try to delete before third backup"
|
||||||
|
@ -70,8 +70,8 @@ echo '###### Status DELETED ######'
|
|||||||
init_catalog
|
init_catalog
|
||||||
pg_arman backup -B ${BACKUP_PATH} -b full -p ${TEST_PGPORT} -d postgres --quiet;echo $?
|
pg_arman backup -B ${BACKUP_PATH} -b full -p ${TEST_PGPORT} -d postgres --quiet;echo $?
|
||||||
pg_arman validate -B ${BACKUP_PATH} --quiet > /dev/null 2>&1;echo $?
|
pg_arman validate -B ${BACKUP_PATH} --quiet > /dev/null 2>&1;echo $?
|
||||||
DELETE_DATE=`date +"%Y-%m-%d %H:%M:%S"`
|
|
||||||
pg_arman backup -B ${BACKUP_PATH} -b full -p ${TEST_PGPORT} -d postgres --quiet;echo $?
|
pg_arman backup -B ${BACKUP_PATH} -b full -p ${TEST_PGPORT} -d postgres --quiet;echo $?
|
||||||
|
DELETE_DATE=$(get_time_last_backup)
|
||||||
pg_arman validate -B ${BACKUP_PATH} --quiet > /dev/null 2>&1;echo $?
|
pg_arman validate -B ${BACKUP_PATH} --quiet > /dev/null 2>&1;echo $?
|
||||||
pg_arman delete ${DELETE_DATE} -B ${BACKUP_PATH} > /dev/null 2>&1;echo $?
|
pg_arman delete ${DELETE_DATE} -B ${BACKUP_PATH} > /dev/null 2>&1;echo $?
|
||||||
pg_arman show -B ${BACKUP_PATH} > ${TEST_BASE}/TEST-0004-show.out 2>&1
|
pg_arman show -B ${BACKUP_PATH} > ${TEST_BASE}/TEST-0004-show.out 2>&1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user