Sync the backup to Google Drive every day
This commit is contained in:
parent
2046329111
commit
e32fde2ddb
4 changed files with 30 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
#! /usr/bin/sh
|
#! /usr/bin/sh
|
||||||
|
|
||||||
systemctl --user enable --now backup.timer
|
systemctl --user enable --now backup.timer
|
||||||
|
systemctl --user enable --now sync-backup.timer
|
||||||
|
|
|
||||||
10
.config/systemd/user/sync-backup.service
Normal file
10
.config/systemd/user/sync-backup.service
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Sync local backup to the cloud
|
||||||
|
Wants=sync-backup.timer
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
WorkingDirectory=%h
|
||||||
|
ExecStart=%h/.local/bin/sync-backup service
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
10
.config/systemd/user/sync-backup.timer
Normal file
10
.config/systemd/user/sync-backup.timer
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Daily backup cloud sync
|
||||||
|
Requires=sync-backup.service
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
Unit=sync-backup.service
|
||||||
|
OnCalendar=daily
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
||||||
9
.local/bin/sync-backup
Executable file
9
.local/bin/sync-backup
Executable file
|
|
@ -0,0 +1,9 @@
|
||||||
|
#! /usr/bin/sh
|
||||||
|
|
||||||
|
export BORG_REPO="/media/backup/"
|
||||||
|
|
||||||
|
if [ "$1" = "service" ]; then
|
||||||
|
rclone sync "${BORG_REPO}" gdrive-backup:hot-repo/
|
||||||
|
else
|
||||||
|
rclone sync --progress "${BORG_REPO}" gdrive-backup:hot-repo/
|
||||||
|
fi
|
||||||
Loading…
Add table
Add a link
Reference in a new issue