Files
shell/move-backups.sh
Peter Wood 58b5dea8b4 Refactor variable assignments and improve script readability in validate-plex-backups.sh and validate-plex-recovery.sh
- Changed inline variable assignments to separate declaration and assignment for clarity.
- Updated condition checks and log messages for better readability and consistency.
- Added a backup of validate-plex-recovery.sh for safety.
- Introduced a new script run-docker-tests.sh for testing setup in Docker containers.
- Enhanced ssh-login.sh to improve condition checks and logging functionality.
2025-06-05 17:14:02 -04:00

40 lines
969 B
Bash
Executable File

#!/bin/bash
uname_str=$(uname -s)
if [ ! "${uname_str:0:5}" == 'Linux' ]; then
exit 1
fi
source="/home/acedanger/backup/docker-data/"
destination="/mnt/share/media/backups/docker-data/"
num_files=$(rsync \
--archive --verbose --progress --dry-run --stats \
-e 'ssh' \
--include '*.gz' \
acedanger@ts-racknerd:"$source" "$destination" \
| grep -F 'Number of files' | cut -d' ' -f4 | tr -d ,
)
# echo 'There are' "${num_files}" 'file(s) to be transferred.'
if [ "$num_files" == 0 ];
then
echo 'There are no files to transfer. Exiting.'
exit 1
fi
# move the files from $source to $destination
rsync \
--recursive --verbose --progress --remove-source-files --archive \
-e 'ssh' \
--include '*.gz' \
acedanger@ts-racknerd:$source $destination
# send a notification to https://notify.peterwood.rocks/lab
curl \
-H priority:default \
-H tags:backups,"${HOSTNAME}" \
-d "The backups have been moved to the NAS." \
https://notify.peterwood.rocks/lab