changed to resticsftp

This commit is contained in:
2024-04-03 09:38:04 -05:00
parent 98a643168e
commit 152421ed2a
7 changed files with 27 additions and 33 deletions

View File

@@ -1,4 +1,4 @@
#!/bin/bash
export RESTIC_PASSWORD="8ung1e1!"
export RESTIC_REPOSITORY="sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/etc"
export RESTIC_REPOSITORY="sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/etc"

View File

@@ -1,4 +1,4 @@
#!/bin/bash
export RESTIC_PASSWORD="8ung1e1!"
export RESTIC_REPOSITORY="sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/home/akanealw"
export RESTIC_REPOSITORY="sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/home/akanealw"

View File

@@ -1,4 +1,4 @@
#!/bin/bash
export RESTIC_PASSWORD="8ung1e1!"
export RESTIC_REPOSITORY="sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/opt"
export RESTIC_REPOSITORY="sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/opt"

View File

@@ -1,4 +1,4 @@
#!/bin/bash
export RESTIC_PASSWORD="8ung1e1!"
export RESTIC_REPOSITORY="sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/root"
export RESTIC_REPOSITORY="sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/root"

View File

@@ -1,11 +1,5 @@
#!/bin/bash
rm -r /home/akanealw/.config/wrestic > /dev/null 2>&1
rm -r /root/.config/wrestic > /dev/null 2>&1
rm -r /usr/local/bin/wrestic > /dev/null 2>&1
rm /home/akanealw/scripts/wrestic-backup-to-truenas.sh > /dev/null 2>&1
rm /root/scripts/wrestic-backup-to-truenas.sh > /dev/null 2>&1
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-sftp/restic-sftp-backup.sh -P /root/scripts/restic
@@ -22,28 +16,28 @@ if [[ ! -f /root/.ssh/config ]]; then
touch /root/.ssh/config
fi
isInFile=$(cat /root/.ssh/config | grep -c "truenas")
isInFile=$(cat /root/.ssh/config | grep -c "resticssftp")
if [ $isInFile -eq 0 ]
then
echo "" >> /root/.ssh/config
echo "Host truenas" >> /root/.ssh/config
echo "Hostname 192.168.1.41" >> /root/.ssh/config
echo "Host resticssftp" >> /root/.ssh/config
echo "Hostname 192.168.1.51" >> /root/.ssh/config
echo "Port 22" >> /root/.ssh/config
echo "User akanealw" >> /root/.ssh/config
echo "IdentityFile ~/.ssh/truenas" >> /root/.ssh/config
echo "User root" >> /root/.ssh/config
echo "IdentityFile ~/.ssh/resticssftp" >> /root/.ssh/config
echo "StrictHostKeyChecking no" >> /root/.ssh/config
chmod 600 /root/.ssh/config
fi
if [[ ! -f /root/.ssh/truenas ]] > /dev/null 2>&1
if [[ ! -f /root/.ssh/resticssftp ]] > /dev/null 2>&1
then
echo "-----BEGIN OPENSSH PRIVATE KEY-----" > /root/.ssh/truenas
echo "b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW" >> /root/.ssh/truenas
echo "QyNTUxOQAAACCDKl0DNjKWKlSpbCGeKjmA3tc0pKDvAiMfWQ83h0JVlQAAAJhNQ67sTUOu" >> /root/.ssh/truenas
echo "7AAAAAtzc2gtZWQyNTUxOQAAACCDKl0DNjKWKlSpbCGeKjmA3tc0pKDvAiMfWQ83h0JVlQ" >> /root/.ssh/truenas
echo "AAAEBoM2bsFqToHCHKO3F6MvOlObGaiNXw6UPcyBlyfbSAvYMqXQM2MpYqVKlsIZ4qOYDe" >> /root/.ssh/truenas
echo "1zSkoO8CIx9ZDzeHQlWVAAAAEWFrYW5lYWx3QExhcHRvcFBDAQIDBA==" >> /root/.ssh/truenas
echo "-----END OPENSSH PRIVATE KEY-----" >> /root/.ssh/truenas
chown root:root /root/.ssh/truenas
chmod 600 /root/.ssh/truenas
echo "-----BEGIN OPENSSH PRIVATE KEY-----" > /root/.ssh/resticssftp
echo "b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW" >> /root/.ssh/resticssftp
echo "QyNTUxOQAAACC1aqAAHasdh+NMiX+v0iatWv/jwq9+nhPUSKs2oTlzkQAAAJBweDwvcHg8" >> /root/.ssh/resticssftp
echo "LwAAAAtzc2gtZWQyNTUxOQAAACC1aqAAHasdh+NMiX+v0iatWv/jwq9+nhPUSKs2oTlzkQ" >> /root/.ssh/resticssftp
echo "AAAEB7kN9ngDVf30Nr/C3f236ml6UiXi07X2szfLvNPvpQp7VqoAAdqx2H40yJf6/SJq1a" >> /root/.ssh/resticssftp
echo "/+PCr36eE9RIqzahOXORAAAACnJlc3RpY3NmdHABAgM=" >> /root/.ssh/resticssftp
echo "-----END OPENSSH PRIVATE KEY-----" >> /root/.ssh/resticssftp
chown root:root /root/.ssh/resticssftp
chmod 600 /root/.ssh/resticssftp
fi

View File

@@ -3,28 +3,28 @@
export RESTIC_PASSWORD="8ung1e1!"
# backup /home/akanealw
export RESTIC_REPOSITORY="sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/home/akanealw"
export RESTIC_REPOSITORY="sftp:root@resticssftp:/mnt/data/backups/resticbackups/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="sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/etc"
export RESTIC_REPOSITORY="sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/etc"
restic unlock
restic backup /etc --no-cache -v
restic unlock
restic forget --keep-last 25 --prune
# backup /opt
export RESTIC_REPOSITORY="sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/opt"
export RESTIC_REPOSITORY="sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/opt"
restic unlock
restic backup /opt --no-cache -v
restic unlock
restic forget --keep-last 25 --prune
# backup /root
export RESTIC_REPOSITORY="sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/root"
export RESTIC_REPOSITORY="sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/root"
restic unlock
restic backup /root --no-cache -v
restic unlock

View File

@@ -2,7 +2,7 @@
export RESTIC_PASSWORD="8ung1e1!"
restic -r sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/home/akanealw init
restic -r sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/etc init
restic -r sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/opt init
restic -r sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/root init
restic -r sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/home/akanealw init
restic -r sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/etc init
restic -r sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/opt init
restic -r sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/root init