fix: file changed as tar read it
This commit is contained in:
parent
8b15f665ef
commit
caaa607e94
3 changed files with 19 additions and 13 deletions
|
|
@ -47,8 +47,8 @@ set -e
|
|||
|
||||
if ! ssh "${remote}" "test -f '${env_file:=.env}'"; then
|
||||
>&2 printf "Error: Environment file does not exist: '%s'.\n" "${env_file}"
|
||||
>&2 printf "Debug: PWD: '%s'.\n" "$(ssh "${remote}" 'pwd')"
|
||||
>&2 printf " Consider using the option '-e' to specify the correct environment file.\n"
|
||||
>&2 printf "Debug: PWD: '%s'.\n" "$(ssh "${remote}" 'pwd')"
|
||||
usage 2
|
||||
elif ! ssh "${remote}" "test -r '${env_file:=.env}'"; then
|
||||
>&2 printf "Error: Environment file is not readable: '%s'.\n" "${env_file}"
|
||||
|
|
@ -96,13 +96,15 @@ ssh "${remote}" "cp -a '/var/www/nextcloud/themes' '${remote_destination}'"
|
|||
ssh "${remote}" 'sudo -u www-data /usr/bin/php /var/www/nextcloud/occ maintenance:mode --off'
|
||||
|
||||
# Copy everything over to local machine.
|
||||
echo 'Info: Creating archive'
|
||||
remote_archive="$( ssh "${remote}" 'mktemp' )"
|
||||
ssh "${remote}" "tar -czf '${remote_archive}' ${remote_destination}"
|
||||
echo 'Info: Copying to local machine.'
|
||||
ssh "${remote}" "tar -czf '/tmp/${backupfile}' ${remote_destination}"
|
||||
scp "${remote}:/tmp/${backupfile}" "${local_destination}"
|
||||
scp "${remote}:${remote_archive}" "${local_destination}/${backupfile}"
|
||||
|
||||
# Remove temporary destination on remote host.
|
||||
printf "Debug: Cleaning up '%s' on %s.\n" "${remote_destination}" "${remote}"
|
||||
ssh "${remote}" "rm -rf ${remote_destination}"
|
||||
printf "Debug: Cleaning up '%s' on %s.\n" "${remote_destination},${remote_archive}" "${remote}"
|
||||
ssh "${remote}" "rm -rf ${remote_destination} ${remote_archive}"
|
||||
|
||||
# Backup cleanup
|
||||
# Only keep 30 days of backups
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue