From f6b508cc67c79b225d88f66c0fbfce787c80ace2 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 18 May 2019 23:10:32 -0300 Subject: Add ArchiveBox setup - add repo to mrconfig; - create daily log file; - add `archivebox` executable to $PATH; - create cronjob to run every 12 hours; - backup ~/archive/ folder. Side note: medium.com DNS resolves to an IPv6 address but rejects connections from clients that try to reach medium using it. I had to force an IPv4 connection instead. --- scripts/archive.sh | 13 +++++++++++++ scripts/backup.sh | 27 +++++++++++++++++++-------- scripts/wget-4.sh | 2 ++ 3 files changed, 34 insertions(+), 8 deletions(-) create mode 100755 scripts/archive.sh create mode 100755 scripts/wget-4.sh (limited to 'scripts') diff --git a/scripts/archive.sh b/scripts/archive.sh new file mode 100755 index 0000000..416b833 --- /dev/null +++ b/scripts/archive.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -euo pipefail +cd "$(dirname "${BASH_SOURCE[0]}")" + +export POCKET_ARCHIVE='https://getpocket.com/users/euandreh/feed/read' +export OUTPUT_DIR="$HOME/archive/archivebox/" +export WGET_BINARY="$PWD/wget-4.sh" +export FETCH_MEDIA=False +if [ "${1-}" = "-s" ]; then + curl -s "$POCKET_ARCHIVE" | archivebox >> /tmp/archivebox.log +else + curl -s "$POCKET_ARCHIVE" | archivebox +fi diff --git a/scripts/backup.sh b/scripts/backup.sh index f31a503..b13108f 100755 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -6,16 +6,21 @@ # if [ ! -d ~/UTCLOUD/ ]; then - red "$HOME/UTCLOUD not attached. Backup not started." - exit 1 + red "$HOME/UTCLOUD not attached. Backup not started." + exit 1 +fi + +if [ ! -d ~/archive/ ]; then + yellow "$HOME/archive/ folder doesn't exist. Downloading latest version from ~/UTCLOUD/archive/ into ~/archive/." + rsync --verbose --progress --stats --update --recursive ~/UTCLOUD/archive/ ~/archive fi if [ ! -d ~/borgbackup/ ]; then - yellow "$HOME/borgbackup/ repository doesn't exist. Downloading latest version from ~/UTCLOUD/borg/borgbackup/ into ~/borgbackup/" - # The initial borg repo was created with: - # $ borg init --append-only --encryption=keyfile ~/borgbackup - # See also: https://borgbackup.readthedocs.io/en/stable/usage/notes.html#append-only-mode - rsync --verbose --progress --stats --update --recursive ~/UTCLOUD/borg/borgbackup/ ~/borgbackup + yellow "$HOME/borgbackup/ repository doesn't exist. Downloading latest version from ~/UTCLOUD/borg/borgbackup/ into ~/borgbackup/." + # The initial borg repo was created with: + # $ borg init --append-only --encryption=keyfile ~/borgbackup + # See also: https://borgbackup.readthedocs.io/en/stable/usage/notes.html#append-only-mode + rsync --verbose --progress --stats --update --recursive ~/UTCLOUD/borg/borgbackup/ ~/borgbackup fi BACKUP_TAG="${1-default}" @@ -28,10 +33,16 @@ borg create \ --compression lzma,6 \ ~/borgbackup::"{hostname}-{now}-${BACKUP_TAG}" \ ~/ownCloud/ \ - ~/mbsync/ + ~/Nextcloud/ \ + ~/mbsync/ \ + ~/archive/ # add folders to be backed up here green "Done" +yellow "Syncing ~/archive to ~/UTCLOUD/archive" +rsync --verbose --progress --stats --update --recursive ~/archive/ ~/UTCLOUD/archive/ +green "Done" + yellow "Syncing ~/borgbackup to ~/UTCLOUD/borg/borgbackup/" rsync --verbose --progress --stats --update --recursive ~/borgbackup/ ~/UTCLOUD/borg/borgbackup/ green "Done" diff --git a/scripts/wget-4.sh b/scripts/wget-4.sh new file mode 100755 index 0000000..1066441 --- /dev/null +++ b/scripts/wget-4.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +wget -4 "$@" -- cgit v1.2.3