summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2020-10-06 17:43:07 -0700
committerFranck Cuny <franck@fcuny.net>2020-10-06 17:43:07 -0700
commit716f682cf43919230649082f9a4fc26ce32e8c24 (patch)
tree165d643ca4c388fc59de03041bad6448e6675b3f
parentdesktop: drop screenshot directory (diff)
downloademacs.d-716f682cf43919230649082f9a4fc26ce32e8c24.tar.gz
linux: create service for backing up
I want to backup my $HOME to the nas using restic.
Diffstat (limited to '')
-rw-r--r--Makefile12
-rw-r--r--config/systemd/user/backup.service13
2 files changed, 23 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index c1301b4..c1ad336 100644
--- a/Makefile
+++ b/Makefile
@@ -83,10 +83,18 @@ endif
 
 .PHONY: redshift
 redshift:
-	$(PACMAN )redshift
+	$(PACMAN) redshift
 	$(LN) $(PWD)/config/redshift.conf $(HOME)/.config/redshift.conf
 	@systemctl --user enable redshift
 
+.PHONY: resticcfg
+resticcfg:
+	@mkdir -p $(HOME)/.config/restic
+	$(PACMAN) restic
+	$(LN) $(PWD)/config/systemd/user/backup.service $(HOME)/.config/systemd/user/backup.service
+	@systemctl --user daemon-reload
+	@systemctl --user enable backup
+
 .PHONY: tmux
 tmux:
 ifeq ($(CURRENT_OS),Linux)
@@ -106,7 +114,7 @@ clean-dead:
 install: $(HOME)/workspace $(HOME)/.ssh/authorized_keys git tmux emacs
 
 .PHONY: install-linux
-install-linux: redshift desktop
+install-linux: redshift desktop resticcfg modmap
 
 .PHONY: install-darwin
 install-darwin: screenshots
diff --git a/config/systemd/user/backup.service b/config/systemd/user/backup.service
new file mode 100644
index 0000000..a2f2d18
--- /dev/null
+++ b/config/systemd/user/backup.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=backup my home directory
+
+[Service]
+Type=oneshot
+
+Environment=RESTIC_REPOSITORY=rest:http://nas:8010/
+Environment=RESTIC_PASSWORD_FILE=/home/fcuny/.config/restic/password
+
+ExecStart=/usr/bin/restic --tag=home --exclude=/home/fcuny/.cache --exclude=/home/fcuny/.mozilla --exclude=/home/fcuny/.config/chromium backup /home/fcuny
+
+[Install]
+WantedBy=default.target