fixed local names
This commit is contained in:
parent
657ea56d3d
commit
3ff373498b
2 changed files with 61 additions and 61 deletions
|
@ -5,9 +5,9 @@ function init-file-repo() {
|
|||
|
||||
if [ -z ${CERTIFICATE_FILE} ];
|
||||
then
|
||||
${command} --cacert ${CERTIFICATE_FILE}
|
||||
${command}
|
||||
else
|
||||
${command}
|
||||
${command} --cacert ${CERTIFICATE_FILE}
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -15,19 +15,19 @@ function init-file-repo() {
|
|||
function backup-directory() {
|
||||
local directory="$1"; shift
|
||||
|
||||
local command-unlock="restic -v -r ${RESTIC_REPOSITORY}/files unlock --cleanup-cache"
|
||||
local command-backup="cd ${directory} && restic -v -r ${RESTIC_REPOSITORY}/files backup ."
|
||||
local command-forget="restic -v -r ${RESTIC_REPOSITORY}/files forget --keep-last 1 --keep-within ${RESTIC_DAYS_TO_KEEP}d --prune"
|
||||
local command_unlock="restic -v -r ${RESTIC_REPOSITORY}/files unlock --cleanup-cache"
|
||||
local command_backup="cd ${directory} && restic -v -r ${RESTIC_REPOSITORY}/files backup ."
|
||||
local command_forget="restic -v -r ${RESTIC_REPOSITORY}/files forget --keep-last 1 --keep-within ${RESTIC_DAYS_TO_KEEP}d --prune"
|
||||
|
||||
if [ -z ${CERTIFICATE_FILE} ];
|
||||
then
|
||||
${command-unlock} --cacert ${CERTIFICATE_FILE}
|
||||
${command-backup} --cacert ${CERTIFICATE_FILE}
|
||||
${command-forget} --cacert ${CERTIFICATE_FILE}
|
||||
${command_unlock}
|
||||
${command_backup}
|
||||
${command_forget}
|
||||
else
|
||||
${command-unlock}
|
||||
${command-backup}
|
||||
${command-forget}
|
||||
${command_unlock} --cacert ${CERTIFICATE_FILE}
|
||||
${command_backup} --cacert ${CERTIFICATE_FILE}
|
||||
${command_forget} --cacert ${CERTIFICATE_FILE}
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -35,19 +35,19 @@ function backup-directory() {
|
|||
function backup-fs-from-directory() {
|
||||
local directory="$1"; shift
|
||||
|
||||
local command-unlock="restic -v -r ${RESTIC_REPOSITORY}/files unlock --cleanup-cache"
|
||||
local command-backup="cd ${directory} && restic -v -r ${RESTIC_REPOSITORY}/files backup $@"
|
||||
local command-forget="restic -v -r ${RESTIC_REPOSITORY}/files forget --keep-last 1 --keep-within ${RESTIC_DAYS_TO_KEEP}d --prune"
|
||||
local command_unlock="restic -v -r ${RESTIC_REPOSITORY}/files unlock --cleanup-cache"
|
||||
local command_backup="cd ${directory} && restic -v -r ${RESTIC_REPOSITORY}/files backup $@"
|
||||
local command_forget="restic -v -r ${RESTIC_REPOSITORY}/files forget --keep-last 1 --keep-within ${RESTIC_DAYS_TO_KEEP}d --prune"
|
||||
|
||||
if [ -z ${CERTIFICATE_FILE} ];
|
||||
then
|
||||
${command-unlock} --cacert ${CERTIFICATE_FILE}
|
||||
${command-backup} --cacert ${CERTIFICATE_FILE}
|
||||
${command-forget} --cacert ${CERTIFICATE_FILE}
|
||||
${command_unlock}
|
||||
${command_backup}
|
||||
${command_forget}
|
||||
else
|
||||
${command-unlock}
|
||||
${command-backup}
|
||||
${command-forget}
|
||||
${command_unlock} --cacert ${CERTIFICATE_FILE}
|
||||
${command_backup} --cacert ${CERTIFICATE_FILE}
|
||||
${command_forget} --cacert ${CERTIFICATE_FILE}
|
||||
fi
|
||||
|
||||
}
|
||||
|
@ -55,18 +55,18 @@ function backup-fs-from-directory() {
|
|||
function restore-directory() {
|
||||
local directory="$1"; shift
|
||||
|
||||
local command-unlock="restic -v -r ${RESTIC_REPOSITORY}/files unlock --cleanup-cache"
|
||||
local command-restore="restic -v -r $RESTIC_REPOSITORY/files restore latest --target ${directory}"
|
||||
local command_unlock="restic -v -r ${RESTIC_REPOSITORY}/files unlock --cleanup-cache"
|
||||
local command_restore="restic -v -r $RESTIC_REPOSITORY/files restore latest --target ${directory}"
|
||||
|
||||
if [ -z ${CERTIFICATE_FILE} ];
|
||||
then
|
||||
${command-unlock} --cacert ${CERTIFICATE_FILE}
|
||||
${command_unlock}
|
||||
rm -rf ${directory}*
|
||||
${command-restore} --cacert ${CERTIFICATE_FILE}
|
||||
${command_restore}
|
||||
else
|
||||
${command-unlock}
|
||||
${command_unlock} --cacert ${CERTIFICATE_FILE}
|
||||
rm -rf ${directory}*
|
||||
${command-restore}
|
||||
${command_restore} --cacert ${CERTIFICATE_FILE}
|
||||
fi
|
||||
|
||||
}
|
|
@ -4,9 +4,9 @@ function init-role-repo() {
|
|||
|
||||
if [ -z ${CERTIFICATE_FILE} ];
|
||||
then
|
||||
${command} --cacert ${CERTIFICATE_FILE}
|
||||
${command}
|
||||
else
|
||||
${command}
|
||||
${command} --cacert ${CERTIFICATE_FILE}
|
||||
fi
|
||||
|
||||
}
|
||||
|
@ -16,9 +16,9 @@ function init-database-repo() {
|
|||
|
||||
if [ -z ${CERTIFICATE_FILE} ];
|
||||
then
|
||||
${command} --cacert ${CERTIFICATE_FILE}
|
||||
${command}
|
||||
else
|
||||
${command}
|
||||
${command} --cacert ${CERTIFICATE_FILE}
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -40,71 +40,71 @@ function create-pg-pass() {
|
|||
function backup-roles() {
|
||||
local role_prefix="$1"; shift
|
||||
|
||||
local command-unlock="restic -v -r ${RESTIC_REPOSITORY}/pg-role unlock --cleanup-cache"
|
||||
local command-pg-dump="pg_dumpall -h ${POSTGRES_SERVICE} -p ${POSTGRES_PORT} -U${POSTGRES_USER} --no-password --roles-only | \
|
||||
grep "${role_prefix}" | \
|
||||
local command_unlock="restic -v -r ${RESTIC_REPOSITORY}/pg-role unlock --cleanup-cache"
|
||||
local command_pg_dump="pg_dumpall -h ${POSTGRES_SERVICE} -p ${POSTGRES_PORT} -U${POSTGRES_USER} --no-password --roles-only | \
|
||||
grep ${role_prefix} | \
|
||||
restic -r ${RESTIC_REPOSITORY}/pg-role backup --stdin"
|
||||
local command-forget="restic -v -r ${RESTIC_REPOSITORY}/pg-role forget --keep-last 1 --keep-within ${RESTIC_DAYS_TO_KEEP}d --prune"
|
||||
local command_forget="restic -v -r ${RESTIC_REPOSITORY}/pg-role forget --keep-last 1 --keep-within ${RESTIC_DAYS_TO_KEEP}d --prune"
|
||||
|
||||
if [ -z ${CERTIFICATE_FILE} ];
|
||||
then
|
||||
${command-unlock} --cacert ${CERTIFICATE_FILE}
|
||||
${command-pg-dump} --cacert ${CERTIFICATE_FILE}
|
||||
${command-forget} --cacert ${CERTIFICATE_FILE}
|
||||
${command_unlock}
|
||||
${command_pg_dump}
|
||||
${command_forget}
|
||||
else
|
||||
${command-unlock}
|
||||
${command-pg-dump}
|
||||
${command-forget}
|
||||
${command_unlock} --cacert ${CERTIFICATE_FILE}
|
||||
${command_pg_dump} --cacert ${CERTIFICATE_FILE}
|
||||
${command_forget} --cacert ${CERTIFICATE_FILE}
|
||||
fi
|
||||
}
|
||||
|
||||
function backup-db-dump() {
|
||||
local command-unlock="restic -v -r ${RESTIC_REPOSITORY}/pg-database unlock --cleanup-cache"
|
||||
local command-pg-dump="pg_dump -d ${POSTGRES_DB} -h ${POSTGRES_SERVICE} -p ${POSTGRES_PORT} \
|
||||
local command_unlock="restic -v -r ${RESTIC_REPOSITORY}/pg-database unlock --cleanup-cache"
|
||||
local command_pg_dump="pg_dump -d ${POSTGRES_DB} -h ${POSTGRES_SERVICE} -p ${POSTGRES_PORT} \
|
||||
-U ${POSTGRES_USER} --no-password --serializable-deferrable | \
|
||||
restic -r ${RESTIC_REPOSITORY}/pg-database backup --stdin"
|
||||
local command-forget="restic -v -r ${RESTIC_REPOSITORY}/pg-database forget --keep-last 1 --keep-within ${RESTIC_DAYS_TO_KEEP}d --prune"
|
||||
local command_forget="restic -v -r ${RESTIC_REPOSITORY}/pg-database forget --keep-last 1 --keep-within ${RESTIC_DAYS_TO_KEEP}d --prune"
|
||||
|
||||
if [ -z ${CERTIFICATE_FILE} ];
|
||||
then
|
||||
${command-unlock} --cacert ${CERTIFICATE_FILE}
|
||||
${command-pg-dump} --cacert ${CERTIFICATE_FILE}
|
||||
${command-forget} --cacert ${CERTIFICATE_FILE}
|
||||
${command_unlock}
|
||||
${command_pg_dump}
|
||||
${command_forget}
|
||||
else
|
||||
${command-unlock}
|
||||
${command-pg-dump}
|
||||
${command-forget}
|
||||
${command_unlock} --cacert ${CERTIFICATE_FILE}
|
||||
${command_pg_dump} --cacert ${CERTIFICATE_FILE}
|
||||
${command_forget} --cacert ${CERTIFICATE_FILE}
|
||||
fi
|
||||
}
|
||||
|
||||
function restore-roles() {
|
||||
local command-unlock="restic -v -r ${RESTIC_REPOSITORY}/pg-role unlock --cleanup-cache"
|
||||
local command-pg-dump="restic -r ${RESTIC_REPOSITORY}/pg-role dump latest stdin | \
|
||||
local command_unlock="restic -v -r ${RESTIC_REPOSITORY}/pg-role unlock --cleanup-cache"
|
||||
local command_pg_dump="restic -r ${RESTIC_REPOSITORY}/pg-role dump latest stdin | \
|
||||
psql -d template1 -h ${POSTGRES_SERVICE} -p ${POSTGRES_PORT} -U ${POSTGRES_USER} \
|
||||
--no-password"
|
||||
|
||||
if [ -z ${CERTIFICATE_FILE} ];
|
||||
then
|
||||
${command-unlock} --cacert ${CERTIFICATE_FILE}
|
||||
${command-pg-dump} --cacert ${CERTIFICATE_FILE}
|
||||
${command_unlock}
|
||||
${command_pg-dump}
|
||||
else
|
||||
${command-unlock}
|
||||
${command-pg-dump}
|
||||
${command_unlock} --cacert ${CERTIFICATE_FILE}
|
||||
${command_pg_dump} --cacert ${CERTIFICATE_FILE}
|
||||
fi
|
||||
}
|
||||
|
||||
function restore-db() {
|
||||
local command-unlock="restic -v -r ${RESTIC_REPOSITORY}/pg-database unlock --cleanup-cache"
|
||||
local command-pg-dump="restic -r ${RESTIC_REPOSITORY}/pg-database dump latest stdin | \
|
||||
local command_unlock="restic -v -r ${RESTIC_REPOSITORY}/pg-database unlock --cleanup-cache"
|
||||
local command_pg_dump="restic -r ${RESTIC_REPOSITORY}/pg_database dump latest stdin | \
|
||||
psql -d ${POSTGRES_DB} -h ${POSTGRES_SERVICE} -p ${POSTGRES_PORT} -U ${POSTGRES_USER} \
|
||||
--no-password"
|
||||
|
||||
if [ -z ${CERTIFICATE_FILE} ];
|
||||
then
|
||||
${command-unlock} --cacert ${CERTIFICATE_FILE}
|
||||
${command-pg-dump} --cacert ${CERTIFICATE_FILE}
|
||||
${command_unlock}
|
||||
${command_pg_dump}
|
||||
else
|
||||
${command-unlock}
|
||||
${command-pg-dump}
|
||||
${command_unlock} --cacert ${CERTIFICATE_FILE}
|
||||
${command_pg_dump} --cacert ${CERTIFICATE_FILE}
|
||||
fi
|
||||
}
|
Loading…
Reference in a new issue