My way of dealing with offline backups
Find a file
2025-06-24 15:05:47 +02:00
backup_unified.sh updated readme 2025-06-24 15:05:47 +02:00
README.md updated readme 2025-06-24 15:05:47 +02:00

A script I use for doing mirrored copies of data to offline disks, sending notifications to gotify when starting, stopping, or any errors are encountered

TODO:

  • Basic dependancy sanity checks
  • Fix Systemd unit to work with @mount_point

some udev commands noted at https://wiki.fail.pm/edit/Udev

Udev

# /etc/udev/rules.d/69-backup_media.rules
ACTION=="add", SUBSYSTEM=="block", KERNEL=="sd[a-z]?", ENV{ID_SERIAL_SHORT}=="5000c500da01855f", SYMLINK+="mediabackup", RUN+="/usr/bin/systemctl start backup_media"
# /etc/udev/rules.d/70-backup_kserv.rules
ACTION=="add", SUBSYSTEM=="block", KERNEL=="sd[a-z]?", ENV{ID_SERIAL_SHORT}=="ZHZ2BN6T", SYMLINK+="iron14tb", RUN+="/usr/bin/systemctl start backup_kserv"

Systemd Unit

# /etc/systemd/system/backup_media.service
[Unit]
Description=Automated KServ offline Backup

[Service]
ExecStart=/usr/local/bin/backup_unified.sh -d /dev/iron14tb -s /mnt/kserv/ -o /mnt/mediabackup
# /etc/systemd/system/backup_kserv.service
[Unit]
Description=Automated KServ offline Backup

[Service]
ExecStart=/usr/local/bin/backup_unified.sh -d /dev/mediabackup -s /mnt/kstorage -o /mnt/mediabackup