From 21e339a255b333f2a4bf50d0ec1b02b7b287143a Mon Sep 17 00:00:00 2001 From: Andrew Hurley Date: Mon, 26 Dec 2022 15:29:50 +1100 Subject: [PATCH] backup.sh updates etc --- backup.cron | 2 +- backup.sh | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/backup.cron b/backup.cron index a47dd56..beda6f9 100644 --- a/backup.cron +++ b/backup.cron @@ -1 +1 @@ -14 4 * * * root /srv/backup/backup.sh -r "/srv/fsback" docker 2>&1 |tee /srv/fsback/$(date +%^a).log +14 4 * * * root /srv/backup/backup.sh -r "/srv/fsback" docker mailus 2>&1 |tee /srv/fsback/$(date +%^a).log diff --git a/backup.sh b/backup.sh index 9e4e87b..81ae6ea 100755 --- a/backup.sh +++ b/backup.sh @@ -24,13 +24,14 @@ if [[ $# -lt 1 ]]; then pexit "Error: missing project(s)" fi -HN=$(hostname -f) -if [[ ! $HN =~ "." ]]; then - pexit "Error: fully quaififed hostname required (add to /etc/hosts - 127.0.0.11)" +if [[ -n $RSYNC ]]; then + HN=$(hostname -f) + if [[ ! $HN =~ "." ]]; then + pexit "Error: fully quaififed hostname required (add to /etc/hosts - 127.0.0.11)" + fi + printf "Hostname: ${HN}\n" fi -printf "Hostname: ${HN}\n" - pushd /srv/backup || pexit "Error: changing to backup directory" printf "Backup start: $(date)\n" for PROJECT in $@; do