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