Revert "Allow extra args for non-backup commands (#115)"
This reverts commit 2406f078ef.
As of #120
This commit is contained in:
@@ -6,11 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Added
|
### Added
|
||||||
- Support for extra args for all restic commands with `RESTIC_EXTRA_ARGS`. [115](https://github.com/erikw/restic-automatic-backup-scheduler/pull/115/)
|
|
||||||
- Debug scripts by setting `TRACE=1`.
|
- Debug scripts by setting `TRACE=1`.
|
||||||
### Changed
|
### Changed
|
||||||
- Warn on certain unset envvars instead of error-exit.
|
- Warn on certain unset envvars instead of error-exit.
|
||||||
- Allow escaped spaces in EXTRA_ARGS.
|
|
||||||
|
|
||||||
## [7.4.0] - 2023-03-08
|
## [7.4.0] - 2023-03-08
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -64,12 +64,7 @@ IFS=':' read -ra backup_paths <<< "$RESTIC_BACKUP_PATHS"
|
|||||||
# Convert to array, an preserve spaces. See #111
|
# Convert to array, an preserve spaces. See #111
|
||||||
extra_args=( )
|
extra_args=( )
|
||||||
while IFS= read -r -d ''; do
|
while IFS= read -r -d ''; do
|
||||||
extra_args+=( "$REPLY" )
|
extra_args+=( "$REPLY" )
|
||||||
done < <(xargs printf '%s\0' <<<"$RESTIC_EXTRA_ARGS")
|
|
||||||
|
|
||||||
backup_extra_args=( )
|
|
||||||
while IFS= read -r -d ''; do
|
|
||||||
backup_extra_args+=( "$REPLY" )
|
|
||||||
done < <(xargs printf '%s\0' <<<"$RESTIC_BACKUP_EXTRA_ARGS")
|
done < <(xargs printf '%s\0' <<<"$RESTIC_BACKUP_EXTRA_ARGS")
|
||||||
|
|
||||||
B2_ARG=
|
B2_ARG=
|
||||||
@@ -101,8 +96,7 @@ test "$OSTYPE" = msys || FS_ARG=--one-file-system
|
|||||||
# Reference: https://unix.stackexchange.com/questions/146756/forward-sigterm-to-child-in-bash
|
# Reference: https://unix.stackexchange.com/questions/146756/forward-sigterm-to-child-in-bash
|
||||||
|
|
||||||
# Remove locks from other stale processes to keep the automated backup running.
|
# Remove locks from other stale processes to keep the automated backup running.
|
||||||
restic unlock \
|
restic unlock &
|
||||||
"${extra_args[@]}" &
|
|
||||||
wait $!
|
wait $!
|
||||||
|
|
||||||
# Do the backup!
|
# Do the backup!
|
||||||
@@ -116,7 +110,6 @@ restic backup \
|
|||||||
"${B2_ARG[@]}" \
|
"${B2_ARG[@]}" \
|
||||||
"${exclusion_args[@]}" \
|
"${exclusion_args[@]}" \
|
||||||
"${extra_args[@]}" \
|
"${extra_args[@]}" \
|
||||||
"${backup_extra_args[@]}" \
|
|
||||||
"${backup_paths[@]}" &
|
"${backup_paths[@]}" &
|
||||||
wait $!
|
wait $!
|
||||||
|
|
||||||
@@ -127,7 +120,6 @@ restic forget \
|
|||||||
--verbose="$RESTIC_VERBOSITY_LEVEL" \
|
--verbose="$RESTIC_VERBOSITY_LEVEL" \
|
||||||
--tag "$RESTIC_BACKUP_TAG" \
|
--tag "$RESTIC_BACKUP_TAG" \
|
||||||
"${B2_ARG[@]}" \
|
"${B2_ARG[@]}" \
|
||||||
"${extra_args[@]}" \
|
|
||||||
--prune \
|
--prune \
|
||||||
--group-by "paths,tags" \
|
--group-by "paths,tags" \
|
||||||
--keep-hourly "$RESTIC_RETENTION_HOURS" \
|
--keep-hourly "$RESTIC_RETENTION_HOURS" \
|
||||||
@@ -149,13 +141,13 @@ if [ "$RESTIC_NOTIFY_BACKUP_STATS" = true ]; then
|
|||||||
if [ -w "$RESTIC_BACKUP_NOTIFICATION_FILE" ]; then
|
if [ -w "$RESTIC_BACKUP_NOTIFICATION_FILE" ]; then
|
||||||
echo 'Notifications are enabled: Silently computing backup summary stats...'
|
echo 'Notifications are enabled: Silently computing backup summary stats...'
|
||||||
|
|
||||||
snapshot_size=$(restic stats latest --tag "$RESTIC_BACKUP_TAG" "${extra_args[@]}" | grep -i 'total size:' | cut -d ':' -f2 | xargs) # xargs acts as trim
|
snapshot_size=$(restic stats latest --tag "$RESTIC_BACKUP_TAG" | grep -i 'total size:' | cut -d ':' -f2 | xargs) # xargs acts as trim
|
||||||
latest_snapshot_diff=$(restic snapshots --tag "$RESTIC_BACKUP_TAG" --latest 2 --compact "${extra_args[@]}" \
|
latest_snapshot_diff=$(restic snapshots --tag "$RESTIC_BACKUP_TAG" --latest 2 --compact \
|
||||||
| grep -Ei "^[abcdef0-9]{8} " \
|
| grep -Ei "^[abcdef0-9]{8} " \
|
||||||
| awk '{print $1}' \
|
| awk '{print $1}' \
|
||||||
| tail -2 \
|
| tail -2 \
|
||||||
| tr '\n' ' ' \
|
| tr '\n' ' ' \
|
||||||
| xargs restic diff "${extra_args[@]}")
|
| xargs restic diff)
|
||||||
added=$(echo "$latest_snapshot_diff" | grep -i 'added:' | awk '{print $2 " " $3}')
|
added=$(echo "$latest_snapshot_diff" | grep -i 'added:' | awk '{print $2 " " $3}')
|
||||||
removed=$(echo "$latest_snapshot_diff" | grep -i 'removed:' | awk '{print $2 " " $3}')
|
removed=$(echo "$latest_snapshot_diff" | grep -i 'removed:' | awk '{print $2 " " $3}')
|
||||||
|
|
||||||
|
|||||||
@@ -43,10 +43,3 @@ export RESTIC_RETENTION_YEARS=3
|
|||||||
#RESTIC_BACKUP_EXTRA_ARGS="--exclude-file /path/to/extra/exclude/file/a --exclude-file /path/to/extra/exclude/file/b"
|
#RESTIC_BACKUP_EXTRA_ARGS="--exclude-file /path/to/extra/exclude/file/a --exclude-file /path/to/extra/exclude/file/b"
|
||||||
# Example: exclude all directories that have a .git/ directory inside it.
|
# Example: exclude all directories that have a .git/ directory inside it.
|
||||||
#RESTIC_BACKUP_EXTRA_ARGS="--exclude-if-present .git"
|
#RESTIC_BACKUP_EXTRA_ARGS="--exclude-if-present .git"
|
||||||
|
|
||||||
# Optional extra space-separated arguments to all restic commands, i.e. global arguments.
|
|
||||||
# Example: Limit download speed to a maximum of 1000 KiB/s
|
|
||||||
#RESTIC_EXTRA_ARGS="--limit-download 1000"
|
|
||||||
# Example: Set custom sftp parameters or a custom path.
|
|
||||||
#RESTIC_EXTRA_ARGS="--option sftp.command='ssh\ backup-host\ -s\ sftp'"
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user