From 7a28fde055352e1824581bd227ead094a3a7e2be Mon Sep 17 00:00:00 2001 From: Bruno Fontes Date: Tue, 23 Feb 2021 08:57:25 -0300 Subject: [PATCH] Joplin backup script --- Services/backup-joplin.service | 6 ++++++ Services/backup-joplin.sh | 15 +++++++++++++++ Services/backup-joplin.timer | 11 +++++++++++ 3 files changed, 32 insertions(+) create mode 100755 Services/backup-joplin.service create mode 100755 Services/backup-joplin.sh create mode 100755 Services/backup-joplin.timer diff --git a/Services/backup-joplin.service b/Services/backup-joplin.service new file mode 100755 index 0000000..98ba1b3 --- /dev/null +++ b/Services/backup-joplin.service @@ -0,0 +1,6 @@ +[Unit] +Description=Backup joplin weekly + +[Service] +User=bruno +ExecStart=/home/bruno/Apps/linuxShortcuts/Services/backup-joplin.sh diff --git a/Services/backup-joplin.sh b/Services/backup-joplin.sh new file mode 100755 index 0000000..3500a65 --- /dev/null +++ b/Services/backup-joplin.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +BACKUP_DIR="/home/bruno/Backups/Joplin" +JOPLIN_BIN="/bin/joplin" + +$JOPLIN_BIN sync +$JOPLIN_BIN e2ee decrypt + +# Delete old backups +cd "$BACKUP_DIR" +rm -r "./joplin.jex" +rm -rf "./MD" + +$JOPLIN_BIN --log-level debug export --format jex "$BACKUP_DIR/joplin.jex" +$JOPLIN_BIN --log-level debug export --format md "$BACKUP_DIR/MD" diff --git a/Services/backup-joplin.timer b/Services/backup-joplin.timer new file mode 100755 index 0000000..72f5630 --- /dev/null +++ b/Services/backup-joplin.timer @@ -0,0 +1,11 @@ +[Unit] +Description=Backup joplin weekly + +[Timer] +Persistent=true +OnCalendar=Thu *-*-* 10:10:00 +WakeSystem=true +#DayOfWeek Year-Month-Day Hour:Minute:Second + +[Install] +WantedBy=timers.target