From 3c1a219be0dfdfe7a1488c61fef3ccba06fe249e Mon Sep 17 00:00:00 2001 From: akanealw Date: Sat, 25 May 2024 13:29:57 -0500 Subject: [PATCH] added rest-server option --- restic/restic-rest-server/export-etc.sh | 4 +++ .../export-home-akanealw.sh | 4 +++ restic/restic-rest-server/export-opt.sh | 4 +++ restic/restic-rest-server/export-root.sh | 4 +++ .../install-restic-rest-server.sh | 13 ++++++++ .../restic-rest-server-backup.sh | 31 +++++++++++++++++++ .../restic-rest-server-init.sh | 8 +++++ 7 files changed, 68 insertions(+) create mode 100755 restic/restic-rest-server/export-etc.sh create mode 100755 restic/restic-rest-server/export-home-akanealw.sh create mode 100755 restic/restic-rest-server/export-opt.sh create mode 100755 restic/restic-rest-server/export-root.sh create mode 100755 restic/restic-rest-server/install-restic-rest-server.sh create mode 100755 restic/restic-rest-server/restic-rest-server-backup.sh create mode 100755 restic/restic-rest-server/restic-rest-server-init.sh diff --git a/restic/restic-rest-server/export-etc.sh b/restic/restic-rest-server/export-etc.sh new file mode 100755 index 0000000..d0771be --- /dev/null +++ b/restic/restic-rest-server/export-etc.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +export RESTIC_PASSWORD="8ung1e1!" +export RESTIC_REPOSITORY="rest:http://192.168.1.51:8000/changemepls/etc" diff --git a/restic/restic-rest-server/export-home-akanealw.sh b/restic/restic-rest-server/export-home-akanealw.sh new file mode 100755 index 0000000..336cc2c --- /dev/null +++ b/restic/restic-rest-server/export-home-akanealw.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +export RESTIC_PASSWORD="8ung1e1!" +export RESTIC_REPOSITORY="rest:http://192.168.1.51:8000/changemepls/home/akanealw" diff --git a/restic/restic-rest-server/export-opt.sh b/restic/restic-rest-server/export-opt.sh new file mode 100755 index 0000000..c3a07a0 --- /dev/null +++ b/restic/restic-rest-server/export-opt.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +export RESTIC_PASSWORD="8ung1e1!" +export RESTIC_REPOSITORY="rest:http://192.168.1.51:8000/changemepls/opt" diff --git a/restic/restic-rest-server/export-root.sh b/restic/restic-rest-server/export-root.sh new file mode 100755 index 0000000..ac44233 --- /dev/null +++ b/restic/restic-rest-server/export-root.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +export RESTIC_PASSWORD="8ung1e1!" +export RESTIC_REPOSITORY="rest:http://192.168.1.51:8000/changemepls/root" diff --git a/restic/restic-rest-server/install-restic-rest-server.sh b/restic/restic-rest-server/install-restic-rest-server.sh new file mode 100755 index 0000000..23f894e --- /dev/null +++ b/restic/restic-rest-server/install-restic-rest-server.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +mkdir -p /root/scripts/restic > /dev/null 2>&1 +rm /root/scripts/restic/* > /dev/null 2>&1 +wget -q http://192.168.1.50/scripts/restic/restic-rest-server/restic-rest-server-backup.sh -P /root/scripts/restic +wget -q http://192.168.1.50/scripts/restic/restic-rest-server/export-etc.sh -P /root/scripts/restic +wget -q http://192.168.1.50/scripts/restic/restic-rest-server/export-home-akanealw.sh -P /root/scripts/restic +wget -q http://192.168.1.50/scripts/restic/restic-rest-server/export-opt.sh -P /root/scripts/restic +wget -q http://192.168.1.50/scripts/restic/restic-rest-server/export-root.sh -P /root/scripts/restic +wget -q http://192.168.1.50/scripts/restic/restic-rest-server/restic-rest-server-init.sh -P /root/scripts/restic + +chmod +x /root/scripts/restic/* +sed -i "s/changemepls/$(cat /etc/hostname | tr '[:upper:]' '[:lower:]')/g" /root/scripts/restic/* diff --git a/restic/restic-rest-server/restic-rest-server-backup.sh b/restic/restic-rest-server/restic-rest-server-backup.sh new file mode 100755 index 0000000..232db07 --- /dev/null +++ b/restic/restic-rest-server/restic-rest-server-backup.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +export RESTIC_PASSWORD="8ung1e1!" + +# backup /home/akanealw +export RESTIC_REPOSITORY="rest:http://192.168.1.51:8000/changemepls/home/akanealw" +restic unlock +restic backup /home/akanealw --no-cache -v +restic unlock +restic forget --keep-last 25 --prune + +# backup /etc +export RESTIC_REPOSITORY="rest:http://192.168.1.51:8000/changemepls/etc" +restic unlock +restic backup /etc --no-cache -v +restic unlock +restic forget --keep-last 25 --prune + +# backup /opt +export RESTIC_REPOSITORY="rest:http://192.168.1.51:8000/changemepls/opt" +restic unlock +restic backup /opt --no-cache -v +restic unlock +restic forget --keep-last 25 --prune + +# backup /root +export RESTIC_REPOSITORY="rest:http://192.168.1.51:8000/changemepls/root" +restic unlock +restic backup /root --no-cache -v +restic unlock +restic forget --keep-last 25 --prune diff --git a/restic/restic-rest-server/restic-rest-server-init.sh b/restic/restic-rest-server/restic-rest-server-init.sh new file mode 100755 index 0000000..2d2124e --- /dev/null +++ b/restic/restic-rest-server/restic-rest-server-init.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +export RESTIC_PASSWORD="8ung1e1!" + +restic -r rest:http://192.168.1.51:8000/changemepls/home/akanealw init +restic -r rest:http://192.168.1.51:8000/changemepls/etc init +restic -r rest:http://192.168.1.51:8000/changemepls/opt init +restic -r rest:http://192.168.1.51:8000/changemepls/root init