Files
homelab-docs/scripts/backup-immich-photos.sh
Andrey f319133cee Add notification feature to backup scripts for various services
Enhance backup scripts for Nextcloud, Gitea, Paperless, Vaultwarden, Immich, and VPS configurations by adding Telegram notifications upon completion. Include details such as backup size and objects backed up. Update backup documentation to reflect these changes and ensure clarity on backup processes and retention policies.
2026-02-27 20:42:30 +03:00

31 lines
1.2 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Копирование библиотеки фото Immich (оригиналы) с VM 200 на диск бэкапов хоста.
# Запускать на хосте Proxmox под root. Требуется: SSH без пароля root → admin@192.168.1.200; на VM 200 установлен rsync (apt install rsync).
# Результат: /mnt/backup/photos/library/ (зеркало /mnt/data/library с VM 200).
# Без --delete: удалённые в Immich фото в бэкапе остаются (страховка).
set -e
VM_SSH="admin@192.168.1.200"
REMOTE_PATH="/mnt/data/library"
BACKUP_PATH="/mnt/backup/photos/library"
if [ "$(id -u)" -ne 0 ]; then
echo "Запускайте под root."
exit 1
fi
mkdir -p "$BACKUP_PATH"
rsync -az --timeout=3600 \
--exclude=".stfolder" \
"$VM_SSH:$REMOTE_PATH/" "$BACKUP_PATH/"
NOTIFY_SCRIPT="${NOTIFY_SCRIPT:-/root/scripts/notify-telegram.sh}"
if [ -x "$NOTIFY_SCRIPT" ]; then
SIZE=$(du -sh "$BACKUP_PATH" 2>/dev/null | cut -f1) || true
BODY="Резервное копирование завершено.
Объекты: библиотека фото Immich (rsync с VM 200).
Размер копии: ${SIZE:-}."
"$NOTIFY_SCRIPT" "📷 Фото Immich (rsync)" "$BODY" || true
fi