backup piha home
This commit is contained in:
parent
2056a08aac
commit
991718eed0
|
|
@ -59,15 +59,17 @@ if cd "$toBackupDir"; then
|
|||
fi
|
||||
|
||||
if find . \( -type d \( "${prune_expr[@]}" \) -prune \) -o \( -type f ! \( "${name_expr[@]}" \) -print0 \) | tar -czf "$backupsDir/$backupFolderName${dateStamp}.tgz" --null -T -; then
|
||||
chown pi:pi $backupsDir/$backupFolderName${dateStamp}.tgz
|
||||
|
||||
echo "Backup completed successfully: $backupsDir/$backupFolderName${dateStamp}.tgz"
|
||||
|
||||
# Remove backups older than 7 days except last day of month backups
|
||||
find "$backupsDir" -name "${backupFolderPrefix}*.tgz" -type f -mtime +7 | while read -r file; do
|
||||
fileDtgName=$(echo $file | cut -d '_' -f 2)
|
||||
if ! is_last_day_of_month "$fileDtgName"; then
|
||||
rm "$fileDtgName"
|
||||
fi
|
||||
done
|
||||
|
||||
# Remove backups older than 7 days except last day of month backups
|
||||
find "$backupsDir" -name "${backupFolderPrefix}*.tgz" -type f -mtime +7 | while read -r file; do
|
||||
fileDtgName=$(echo $file | cut -d '_' -f 2)
|
||||
if ! is_last_day_of_month "$fileDtgName"; then
|
||||
rm "$fileDtgName"
|
||||
fi
|
||||
done
|
||||
|
||||
else
|
||||
echo "Error creating backup"
|
||||
|
|
|
|||
5
006_backups/send-backup-piha-home.sh
Executable file
5
006_backups/send-backup-piha-home.sh
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
dir=$(dirname $0)
|
||||
|
||||
scp $dir/backup-piha-home.sh pi@piha.local:~/backup-scr/
|
||||
Loading…
Reference in a new issue