From 71cbdae52fc3fc91c24332149dd391a7a15bd8b1 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sun, 2 May 2021 12:54:37 -0400 Subject: [PATCH] uplink mail backup --- bin/uplink-delete-bucket | 5 +++++ homebrew/learning.Brewfile | 1 - mail/backup/rclone.cronjob | 2 ++ mail/backup/setup_uplink | 17 +++++++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100755 bin/uplink-delete-bucket create mode 100644 mail/backup/rclone.cronjob create mode 100755 mail/backup/setup_uplink diff --git a/bin/uplink-delete-bucket b/bin/uplink-delete-bucket new file mode 100755 index 0000000..e742620 --- /dev/null +++ b/bin/uplink-delete-bucket @@ -0,0 +1,5 @@ +#!/bin/sh + +bucket="$1" +access="$2" +uplink ls ${access:+--access "$access"} "sj://$bucket/" | awk '{print $NF}' | xargs -I {} uplink rm ${access:+--access "$access"} "sj://$bucket/{}" diff --git a/homebrew/learning.Brewfile b/homebrew/learning.Brewfile index 928a1b0..82946ef 100644 --- a/homebrew/learning.Brewfile +++ b/homebrew/learning.Brewfile @@ -17,4 +17,3 @@ brew "cjbassi/ytop/ytop" # Fancy system performance brew "nmasur/repo/update-ssh-config" # Update .ssh/config brew "kakoune" # Modal editor brew "awslogs" # View AWS log streams -brew "uplink" # StorJ encrypted storage CLI diff --git a/mail/backup/rclone.cronjob b/mail/backup/rclone.cronjob new file mode 100644 index 0000000..c98c8b7 --- /dev/null +++ b/mail/backup/rclone.cronjob @@ -0,0 +1,2 @@ +# Run backup of mail folder, requires rclone (and uplink, with proper setup) +@hourly root rclone sync /home/noah/Mail/ mail-backup:mail/ diff --git a/mail/backup/setup_uplink b/mail/backup/setup_uplink new file mode 100755 index 0000000..b5a61e0 --- /dev/null +++ b/mail/backup/setup_uplink @@ -0,0 +1,17 @@ +#!/bin/sh + +# First Uplink +curl -L https://github.com/storj/storj/releases/latest/download/uplink_linux_amd64.zip -o uplink_linux_amd64.zip +if ! (which unzip > /dev/null) +then + apt install -y unzip +fi +unzip -o uplink_linux_amd64.zip +rm uplink_linux_amd64.zip +chmod 755 uplink +sudo mv uplink /usr/local/bin/uplink + +# Then rclone +curl https://rclone.org/install.sh | sudo bash + +echo "\n\nNow setup rclone with: rclone config\n"