Compare commits

..

2 Commits

Author SHA1 Message Date
2b36d7c555
Backup does not start on metered connections anymore 2021-02-23 08:58:09 -03:00
7a28fde055
Joplin backup script 2021-02-23 08:57:25 -03:00
6 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1 @@
CONTABO_BACKUP_PATH="/home/bruno/Backups/Contabo"

1
Services/backup-contabo.service Executable file → Normal file
View File

@ -3,3 +3,4 @@ Description=Backup contabo daily
[Service] [Service]
ExecStart=/home/bruno/Backups/Contabo/backup-contabo.sh ExecStart=/home/bruno/Backups/Contabo/backup-contabo.sh
EnvironmentFile=/home/bruno/Apps/linuxShortcuts/Services/backup-contabo.env

View File

@ -1,4 +1,10 @@
#! /bin/bash #! /bin/bash
if [[ `nmcli -t -f GENERAL.METERED dev show | grep "METERED:yes"` ]]; then
echo Backup does not work on metered connections
exit 1
fi
if [[ -z $CONTABO_BACKUP_PATH ]]; then if [[ -z $CONTABO_BACKUP_PATH ]]; then
echo CONTABO_BACKUP_PATH environment not set echo CONTABO_BACKUP_PATH environment not set
exit 1 exit 1

6
Services/backup-joplin.service Executable file
View File

@ -0,0 +1,6 @@
[Unit]
Description=Backup joplin weekly
[Service]
User=bruno
ExecStart=/home/bruno/Apps/linuxShortcuts/Services/backup-joplin.sh

15
Services/backup-joplin.sh Executable file
View File

@ -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"

11
Services/backup-joplin.timer Executable file
View File

@ -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