X-Git-Url: https://code.wpia.club/?p=infra.git;a=blobdiff_plain;f=backup;h=79e7478c04eb6cfa13f285280d4d41d312833620;hp=e1be93e2ad8f85bb9d10d58c1eaa22b5c55ded44;hb=dcffa9ab5e6f696542df9e0c909e62c4935734e2;hpb=34978e07455b07294e62dbf76836c913d712a81f diff --git a/backup b/backup index e1be93e..79e7478 100755 --- a/backup +++ b/backup @@ -103,6 +103,24 @@ EOF mkdir -p "/data/postgres/conf/${postgres_cluster}" printf "auto\n" > "/data/postgres/conf/${postgres_cluster}/start.conf" touch "/data/postgres/conf/${postgres_cluster}/postgresql.conf" + elif [[ $command == journal ]]; then + read -e from + action=$(date -u -d '00:00 today' +%s) + if [[ $action == $from ]]; then + printf "no journals\n" + continue + fi + printf "Until: %s\n" "$action" + for i in $(sudo lxc-ls); do + [[ $i == "base-image" ]] && continue + printf "journal: %s\n" "$i" + if [[ $from == - ]]; then + lxc-attach -n "$i" -- journalctl --utc --until="@$action" -o export | chunked + else + lxc-attach -n "$i" -- journalctl --utc --since="@$from" --until="@$action" -o export | chunked + fi + done + printf "end-of-journals\n" elif [[ $command == end ]]; then printf "end\n" fi