mirror of
https://github.com/acedanger/shell.git
synced 2025-12-05 22:50:18 -08:00
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.
This commit is contained in:
@@ -1,28 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! "$(expr substr $(uname -s) 1 5)" == 'Linux' ]; then
|
||||
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/"
|
||||
|
||||
command="rsync \
|
||||
--archive --verbose --progress --dry-run --stats \
|
||||
-e 'ssh' \
|
||||
--include '*.gz' \
|
||||
acedanger@ts-racknerd:$source $destination \
|
||||
| fgrep 'Number of files' | cut -d' ' -f4 | tr -d ,"
|
||||
|
||||
# echo 'Running command => '
|
||||
# echo $command
|
||||
|
||||
num_files=$(rsync \
|
||||
--archive --verbose --progress --dry-run --stats \
|
||||
-e 'ssh' \
|
||||
--include '*.gz' \
|
||||
acedanger@ts-racknerd:$source $destination \
|
||||
| fgrep 'Number of files' | cut -d' ' -f4 | tr -d ,
|
||||
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.'
|
||||
@@ -43,6 +34,6 @@ rsync \
|
||||
# send a notification to https://notify.peterwood.rocks/lab
|
||||
curl \
|
||||
-H priority:default \
|
||||
-H tags:backups,${HOSTNAME} \
|
||||
-H tags:backups,"${HOSTNAME}" \
|
||||
-d "The backups have been moved to the NAS." \
|
||||
https://notify.peterwood.rocks/lab
|
||||
|
||||
Reference in New Issue
Block a user