From 443b328c785734c4ab7736a853b31fcf0c766f6f Mon Sep 17 00:00:00 2001 From: emkael Date: Sat, 17 Oct 2020 13:13:50 +0200 Subject: rsync/git push configuration for non-interactive user --- .envrc | Bin 364 -> 353 bytes .gitignore | 1 + Makefile | 4 ++-- README.md | 4 ++-- _cron/autocommit | 4 +++- 5 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 .gitignore diff --git a/.envrc b/.envrc index ae05400..14188bc 100644 Binary files a/.envrc and b/.envrc differ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a58bec5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +_log/* diff --git a/Makefile b/Makefile index 72b1396..3ff083c 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ all: FORCE pull: - @rsync ${LIGA_RSYNC_OPTS} -q --delete --exclude=.htaccess --exclude=.git --exclude=.gitignore -urPz ${LIGA_REMOTE_WWW_DIR}/ http + @rsync -e "ssh ${LIGA_SSH_OPTS}" -q --delete --exclude=.htaccess --exclude=.git --exclude=.gitignore -urPz ${LIGA_REMOTE_WWW_DIR}/ http autocommit: pull - @cd http && git diff --quiet || (git add . && git commit -m 'Autocommit' && git push) + @cd http && git diff --quiet || (date && git add . && git commit -m 'Autocommit' && GIT_SSH_COMMAND="ssh ${LIGA_SSH_OPTS}" git push) dumps: FORCE s3cmd -c dumps/.s3config sync ${LIGA_S3_BUCKET} dumps/sync/ diff --git a/README.md b/README.md index e37f758..29afdeb 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,9 @@ Kopia zapasowa z wersjonowaniem zmian: Zmienne środowiskowe: * `LIGA_REMOTE_WWW_DIR`: kopletna zdalna ścieżka do backupu (`user@serwer:/ścieżka`) - * `LIGA_RSYNC_OPTS`: dodatkowe parametry wywołania programu `rsync` (np. wczytujące klucz prywatny do uwierzytelnienia) + * `LIGA_SSH_OPTS`: dodatkowe parametry wywołania programu `ssh` (np. wczytujące klucz prywatny do uwierzytelnienia), przekazywane do poleceń `git push` oraz `rsync` -W przypadku wersjonowania kopii zapasowych, w katalogu wyjściowym `http` musi byćzainicjowane repozytorium Git ze skonfigurowanym zdalnym repozytorium docelowym. +W przypadku wersjonowania kopii zapasowych, w katalogu wyjściowym `http` musi być zainicjowane repozytorium Git ze skonfigurowanym zdalnym repozytorium docelowym. ## Kopie zapasowe baz danych turniejów diff --git a/_cron/autocommit b/_cron/autocommit index 045403f..d7c866a 100644 --- a/_cron/autocommit +++ b/_cron/autocommit @@ -1 +1,3 @@ -# */30 * * * * cd $SITEPATH && make autocommit +SHELL=/bin/bash +*/3 * * * * cd $SITEPATH && source .envrc && make autocommit >> $SITEPATH/_log/autocommit.log +SHELL=/bin/sh -- cgit v1.2.3