From 2b36d7c555cd72fcf664a1c4f59d1ecebb9f3e11 Mon Sep 17 00:00:00 2001 From: Bruno Fontes Date: Tue, 23 Feb 2021 08:58:09 -0300 Subject: [PATCH] Backup does not start on metered connections anymore --- Services/backup-contabo.env | 1 + Services/backup-contabo.service | 1 + Services/backup-contabo.sh | 6 ++++++ 3 files changed, 8 insertions(+) create mode 100644 Services/backup-contabo.env mode change 100755 => 100644 Services/backup-contabo.service diff --git a/Services/backup-contabo.env b/Services/backup-contabo.env new file mode 100644 index 0000000..eb63459 --- /dev/null +++ b/Services/backup-contabo.env @@ -0,0 +1 @@ +CONTABO_BACKUP_PATH="/home/bruno/Backups/Contabo" diff --git a/Services/backup-contabo.service b/Services/backup-contabo.service old mode 100755 new mode 100644 index ede60f0..5db7fb2 --- a/Services/backup-contabo.service +++ b/Services/backup-contabo.service @@ -3,3 +3,4 @@ Description=Backup contabo daily [Service] ExecStart=/home/bruno/Backups/Contabo/backup-contabo.sh +EnvironmentFile=/home/bruno/Apps/linuxShortcuts/Services/backup-contabo.env diff --git a/Services/backup-contabo.sh b/Services/backup-contabo.sh index c9e7cee..5564231 100755 --- a/Services/backup-contabo.sh +++ b/Services/backup-contabo.sh @@ -1,4 +1,10 @@ #! /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 echo CONTABO_BACKUP_PATH environment not set exit 1