aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbackup-notes13
-rw-r--r--backup-notes.service6
-rw-r--r--backup-notes.timer9
3 files changed, 28 insertions, 0 deletions
diff --git a/backup-notes b/backup-notes
new file mode 100755
index 0000000..4cc56e4
--- /dev/null
+++ b/backup-notes
@@ -0,0 +1,13 @@
+#!/bin/env bash
+
+# Source folder to be backed up
+src_folder="/home/lemon/Documents/Notes/"
+
+# Remote server details
+remote_user="lemon"
+remote_host="16693433.xyz"
+remote_port="2222"
+remote_folder="/home/lemon/Backups/Notes"
+
+# Run rsync command to sync the folders
+rsync -avz -e "ssh -p ${remote_port}" ${src_folder} ${remote_user}@${remote_host}:${remote_folder}
diff --git a/backup-notes.service b/backup-notes.service
new file mode 100644
index 0000000..8c223a4
--- /dev/null
+++ b/backup-notes.service
@@ -0,0 +1,6 @@
+[Unit]
+Description=Backup notes to remote server
+
+[Service]
+Type=oneshot
+ExecStart=/home/lemon/code/bash/backup-notes
diff --git a/backup-notes.timer b/backup-notes.timer
new file mode 100644
index 0000000..0ecd080
--- /dev/null
+++ b/backup-notes.timer
@@ -0,0 +1,9 @@
+[Unit]
+Description=Run backup-notes service every 30 minutes
+
+[Timer]
+OnUnitActiveSec=30m
+Unit=backup-notes.service
+
+[Install]
+WantedBy=timers.target