Created
November 19, 2020 12:55
-
-
Save billimek/dec98675dbbb0ed5c12512d3ec734190 to your computer and use it in GitHub Desktop.
rclone/borg backups to backblaze b2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Sync files using rclone | |
[Service] | |
Type=oneshot | |
User=root | |
ExecStart=/root/backup/rclone_borg_sync.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Perform an rclone sync periodically. | |
Requires=rclone-sync.service | |
[Timer] | |
OnCalendar=07:00 | |
RandomizedDelaySec=60 | |
[Install] | |
WantedBy=timers.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
repos=( lb pihole proxmox proxmox-b proxmox-c home ) | |
#Bail if rclone is already running, maybe previous run didn't finish | |
if pidof -x rclone >/dev/null; then | |
echo "Process already running" | |
# exit | |
fi | |
for i in "${repos[@]}" | |
do | |
#Lets see how much space is used by directory to back up | |
#if directory is gone, or has gotten small, we will exit | |
space=`du -s /tank/backups/borg/$i|awk '{print $1}'` | |
if (( $space < 4500 )); then | |
echo "not enough space used in $i ($space) - skipping!" | |
else | |
echo "==================== syncing $i" | |
/usr/bin/rclone --config /root/.config/rclone/rclone.conf -v sync /tank/backups/borg/$i b2-borg:/billimek-borg/$i | |
fi | |
done | |
echo "==================== syncing RESTIC backups" | |
restic_repos=( default monitoring ) | |
for i in "${restic_repos[@]}" | |
do | |
echo "==================== syncing $i" | |
/usr/bin/rclone --config /root/.config/rclone/rclone.conf -v sync /tank/data/minio/velero/restic/$i b2-restic:/billimek-restic/restic/$i | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment