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} ];
|
if [ -z ${CERTIFICATE_FILE} ];
|
||||||
then
|
then
|
||||||
${command} --cacert ${CERTIFICATE_FILE}
|
|
||||||
else
|
|
||||||
${command}
|
${command}
|
||||||
|
else
|
||||||
|
${command} --cacert ${CERTIFICATE_FILE}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,19 +15,19 @@ function init-file-repo() {
|
||||||
function backup-directory() {
|
function backup-directory() {
|
||||||
local directory="$1"; shift
|
local directory="$1"; shift
|
||||||
|
|
||||||
local command-unlock="restic -v -r ${RESTIC_REPOSITORY}/files unlock --cleanup-cache"
|
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_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_forget="restic -v -r ${RESTIC_REPOSITORY}/files forget --keep-last 1 --keep-within ${RESTIC_DAYS_TO_KEEP}d --prune"
|
||||||
|
|
||||||
if [ -z ${CERTIFICATE_FILE} ];
|
if [ -z ${CERTIFICATE_FILE} ];
|
||||||
then
|
then
|
||||||
${command-unlock} --cacert ${CERTIFICATE_FILE}
|
${command_unlock}
|
||||||
${command-backup} --cacert ${CERTIFICATE_FILE}
|
${command_backup}
|
||||||
${command-forget} --cacert ${CERTIFICATE_FILE}
|
${command_forget}
|
||||||
else
|
else
|
||||||
${command-unlock}
|
${command_unlock} --cacert ${CERTIFICATE_FILE}
|
||||||
${command-backup}
|
${command_backup} --cacert ${CERTIFICATE_FILE}
|
||||||
${command-forget}
|
${command_forget} --cacert ${CERTIFICATE_FILE}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,19 +35,19 @@ function backup-directory() {
|
||||||
function backup-fs-from-directory() {
|
function backup-fs-from-directory() {
|
||||||
local directory="$1"; shift
|
local directory="$1"; shift
|
||||||
|
|
||||||
local command-unlock="restic -v -r ${RESTIC_REPOSITORY}/files unlock --cleanup-cache"
|
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_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_forget="restic -v -r ${RESTIC_REPOSITORY}/files forget --keep-last 1 --keep-within ${RESTIC_DAYS_TO_KEEP}d --prune"
|
||||||
|
|
||||||
if [ -z ${CERTIFICATE_FILE} ];
|
if [ -z ${CERTIFICATE_FILE} ];
|
||||||
then
|
then
|
||||||
${command-unlock} --cacert ${CERTIFICATE_FILE}
|
${command_unlock}
|
||||||
${command-backup} --cacert ${CERTIFICATE_FILE}
|
${command_backup}
|
||||||
${command-forget} --cacert ${CERTIFICATE_FILE}
|
${command_forget}
|
||||||
else
|
else
|
||||||
${command-unlock}
|
${command_unlock} --cacert ${CERTIFICATE_FILE}
|
||||||
${command-backup}
|
${command_backup} --cacert ${CERTIFICATE_FILE}
|
||||||
${command-forget}
|
${command_forget} --cacert ${CERTIFICATE_FILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -55,18 +55,18 @@ function backup-fs-from-directory() {
|
||||||
function restore-directory() {
|
function restore-directory() {
|
||||||
local directory="$1"; shift
|
local directory="$1"; shift
|
||||||
|
|
||||||
local command-unlock="restic -v -r ${RESTIC_REPOSITORY}/files unlock --cleanup-cache"
|
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_restore="restic -v -r $RESTIC_REPOSITORY/files restore latest --target ${directory}"
|
||||||
|
|
||||||
if [ -z ${CERTIFICATE_FILE} ];
|
if [ -z ${CERTIFICATE_FILE} ];
|
||||||
then
|
then
|
||||||
${command-unlock} --cacert ${CERTIFICATE_FILE}
|
${command_unlock}
|
||||||
rm -rf ${directory}*
|
rm -rf ${directory}*
|
||||||
${command-restore} --cacert ${CERTIFICATE_FILE}
|
${command_restore}
|
||||||
else
|
else
|
||||||
${command-unlock}
|
${command_unlock} --cacert ${CERTIFICATE_FILE}
|
||||||
rm -rf ${directory}*
|
rm -rf ${directory}*
|
||||||
${command-restore}
|
${command_restore} --cacert ${CERTIFICATE_FILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
|
@ -4,9 +4,9 @@ function init-role-repo() {
|
||||||
|
|
||||||
if [ -z ${CERTIFICATE_FILE} ];
|
if [ -z ${CERTIFICATE_FILE} ];
|
||||||
then
|
then
|
||||||
${command} --cacert ${CERTIFICATE_FILE}
|
|
||||||
else
|
|
||||||
${command}
|
${command}
|
||||||
|
else
|
||||||
|
${command} --cacert ${CERTIFICATE_FILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,9 +16,9 @@ function init-database-repo() {
|
||||||
|
|
||||||
if [ -z ${CERTIFICATE_FILE} ];
|
if [ -z ${CERTIFICATE_FILE} ];
|
||||||
then
|
then
|
||||||
${command} --cacert ${CERTIFICATE_FILE}
|
|
||||||
else
|
|
||||||
${command}
|
${command}
|
||||||
|
else
|
||||||
|
${command} --cacert ${CERTIFICATE_FILE}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,71 +40,71 @@ function create-pg-pass() {
|
||||||
function backup-roles() {
|
function backup-roles() {
|
||||||
local role_prefix="$1"; shift
|
local role_prefix="$1"; shift
|
||||||
|
|
||||||
local command-unlock="restic -v -r ${RESTIC_REPOSITORY}/pg-role unlock --cleanup-cache"
|
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 | \
|
local command_pg_dump="pg_dumpall -h ${POSTGRES_SERVICE} -p ${POSTGRES_PORT} -U${POSTGRES_USER} --no-password --roles-only | \
|
||||||
grep "${role_prefix}" | \
|
grep ${role_prefix} | \
|
||||||
restic -r ${RESTIC_REPOSITORY}/pg-role backup --stdin"
|
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} ];
|
if [ -z ${CERTIFICATE_FILE} ];
|
||||||
then
|
then
|
||||||
${command-unlock} --cacert ${CERTIFICATE_FILE}
|
${command_unlock}
|
||||||
${command-pg-dump} --cacert ${CERTIFICATE_FILE}
|
${command_pg_dump}
|
||||||
${command-forget} --cacert ${CERTIFICATE_FILE}
|
${command_forget}
|
||||||
else
|
else
|
||||||
${command-unlock}
|
${command_unlock} --cacert ${CERTIFICATE_FILE}
|
||||||
${command-pg-dump}
|
${command_pg_dump} --cacert ${CERTIFICATE_FILE}
|
||||||
${command-forget}
|
${command_forget} --cacert ${CERTIFICATE_FILE}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function backup-db-dump() {
|
function backup-db-dump() {
|
||||||
local command-unlock="restic -v -r ${RESTIC_REPOSITORY}/pg-database unlock --cleanup-cache"
|
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_pg_dump="pg_dump -d ${POSTGRES_DB} -h ${POSTGRES_SERVICE} -p ${POSTGRES_PORT} \
|
||||||
-U ${POSTGRES_USER} --no-password --serializable-deferrable | \
|
-U ${POSTGRES_USER} --no-password --serializable-deferrable | \
|
||||||
restic -r ${RESTIC_REPOSITORY}/pg-database backup --stdin"
|
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} ];
|
if [ -z ${CERTIFICATE_FILE} ];
|
||||||
then
|
then
|
||||||
${command-unlock} --cacert ${CERTIFICATE_FILE}
|
${command_unlock}
|
||||||
${command-pg-dump} --cacert ${CERTIFICATE_FILE}
|
${command_pg_dump}
|
||||||
${command-forget} --cacert ${CERTIFICATE_FILE}
|
${command_forget}
|
||||||
else
|
else
|
||||||
${command-unlock}
|
${command_unlock} --cacert ${CERTIFICATE_FILE}
|
||||||
${command-pg-dump}
|
${command_pg_dump} --cacert ${CERTIFICATE_FILE}
|
||||||
${command-forget}
|
${command_forget} --cacert ${CERTIFICATE_FILE}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore-roles() {
|
function restore-roles() {
|
||||||
local command-unlock="restic -v -r ${RESTIC_REPOSITORY}/pg-role unlock --cleanup-cache"
|
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_pg_dump="restic -r ${RESTIC_REPOSITORY}/pg-role dump latest stdin | \
|
||||||
psql -d template1 -h ${POSTGRES_SERVICE} -p ${POSTGRES_PORT} -U ${POSTGRES_USER} \
|
psql -d template1 -h ${POSTGRES_SERVICE} -p ${POSTGRES_PORT} -U ${POSTGRES_USER} \
|
||||||
--no-password"
|
--no-password"
|
||||||
|
|
||||||
if [ -z ${CERTIFICATE_FILE} ];
|
if [ -z ${CERTIFICATE_FILE} ];
|
||||||
then
|
then
|
||||||
${command-unlock} --cacert ${CERTIFICATE_FILE}
|
${command_unlock}
|
||||||
${command-pg-dump} --cacert ${CERTIFICATE_FILE}
|
${command_pg-dump}
|
||||||
else
|
else
|
||||||
${command-unlock}
|
${command_unlock} --cacert ${CERTIFICATE_FILE}
|
||||||
${command-pg-dump}
|
${command_pg_dump} --cacert ${CERTIFICATE_FILE}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore-db() {
|
function restore-db() {
|
||||||
local command-unlock="restic -v -r ${RESTIC_REPOSITORY}/pg-database unlock --cleanup-cache"
|
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_pg_dump="restic -r ${RESTIC_REPOSITORY}/pg_database dump latest stdin | \
|
||||||
psql -d ${POSTGRES_DB} -h ${POSTGRES_SERVICE} -p ${POSTGRES_PORT} -U ${POSTGRES_USER} \
|
psql -d ${POSTGRES_DB} -h ${POSTGRES_SERVICE} -p ${POSTGRES_PORT} -U ${POSTGRES_USER} \
|
||||||
--no-password"
|
--no-password"
|
||||||
|
|
||||||
if [ -z ${CERTIFICATE_FILE} ];
|
if [ -z ${CERTIFICATE_FILE} ];
|
||||||
then
|
then
|
||||||
${command-unlock} --cacert ${CERTIFICATE_FILE}
|
${command_unlock}
|
||||||
${command-pg-dump} --cacert ${CERTIFICATE_FILE}
|
${command_pg_dump}
|
||||||
else
|
else
|
||||||
${command-unlock}
|
${command_unlock} --cacert ${CERTIFICATE_FILE}
|
||||||
${command-pg-dump}
|
${command_pg_dump} --cacert ${CERTIFICATE_FILE}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
Loading…
Reference in a new issue