testing restic scripts
This commit is contained in:
0
restic/restic-backup.sh
Normal file
0
restic/restic-backup.sh
Normal file
4
restic/restic-init-local.sh
Normal file
4
restic/restic-init-local.sh
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export RESTIC_PASSWORD="8ung1e1!"
|
||||||
|
|
||||||
4
restic/restic-init-lxc.sh
Normal file
4
restic/restic-init-lxc.sh
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export RESTIC_PASSWORD="8ung1e1!"
|
||||||
|
|
||||||
31
restic/restic-sftp/restic-sftp-backup.sh
Normal file
31
restic/restic-sftp/restic-sftp-backup.sh
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export RESTIC_PASSWORD="8ung1e1!"
|
||||||
|
|
||||||
|
# backup /home/akanealw
|
||||||
|
export RESTIC_REPOSITORY="sftp:akanealw@truenas:/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"
|
||||||
|
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"
|
||||||
|
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"
|
||||||
|
restic unlock
|
||||||
|
restic backup /root --no-cache -v
|
||||||
|
restic unlock
|
||||||
|
restic forget --keep-last 25 --prune
|
||||||
4
restic/restic-sftp/restic-sftp-export-etc.sh
Normal file
4
restic/restic-sftp/restic-sftp-export-etc.sh
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export RESTIC_PASSWORD="8ung1e1!"
|
||||||
|
export RESTIC_REPOSITORY="sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/etc"
|
||||||
4
restic/restic-sftp/restic-sftp-export-home-akanealw.sh
Normal file
4
restic/restic-sftp/restic-sftp-export-home-akanealw.sh
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export RESTIC_PASSWORD="8ung1e1!"
|
||||||
|
export RESTIC_REPOSITORY="sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/home/akanealw"
|
||||||
4
restic/restic-sftp/restic-sftp-export-opt.sh
Normal file
4
restic/restic-sftp/restic-sftp-export-opt.sh
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export RESTIC_PASSWORD="8ung1e1!"
|
||||||
|
export RESTIC_REPOSITORY="sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/opt"
|
||||||
4
restic/restic-sftp/restic-sftp-export-root.sh
Normal file
4
restic/restic-sftp/restic-sftp-export-root.sh
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export RESTIC_PASSWORD="8ung1e1!"
|
||||||
|
export RESTIC_REPOSITORY="sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/root"
|
||||||
8
restic/restic-sftp/restic-sftp-init.sh
Normal file
8
restic/restic-sftp/restic-sftp-init.sh
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
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
|
||||||
39
restic/restic-sftp/restic-sftp-install.sh
Normal file
39
restic/restic-sftp/restic-sftp-install.sh
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
mkdir -p /root/scripts/restic
|
||||||
|
|
||||||
|
wget -qO http://192.168.1.50/scripts/restic/restic-sftp/restic-sftp-backup.sh
|
||||||
|
wget -qO http://192.168.1.50/scripts/restic/restic-sftp/restic-sftp-export-etc.sh
|
||||||
|
wget -qO http://192.168.1.50/scripts/restic/restic-sftp/restic-sftp-export-home-akanealw.sh
|
||||||
|
wget -qO http://192.168.1.50/scripts/restic/restic-sftp/restic-sftp-export-opt.sh
|
||||||
|
wget -qO http://192.168.1.50/scripts/restic/restic-sftp/restic-sftp-export-root.sh
|
||||||
|
wget -qO http://192.168.1.50/scripts/restic/restic-sftp/restic-sftp-init.sh
|
||||||
|
|
||||||
|
mv /root/restic-sftp-* /root/scripts/restic
|
||||||
|
chmod +x /root/scripts/restic/*
|
||||||
|
|
||||||
|
isInFile=$(cat /home/root/.ssh/config | grep -c "truenas")
|
||||||
|
if [ $isInFile -eq 0 ]
|
||||||
|
then
|
||||||
|
echo "" >> /home/root/.ssh/config
|
||||||
|
echo "Host truenas" >> /home/root/.ssh/config
|
||||||
|
echo "Hostname 192.168.1.41" >> /home/root/.ssh/config
|
||||||
|
echo "Port 22" >> /home/root/.ssh/config
|
||||||
|
echo "User akanealw" >> /home/root/.ssh/config
|
||||||
|
echo "IdentityFile ~/.ssh/truenas" >> /home/root/.ssh/config
|
||||||
|
echo "StrictHostKeyChecking no" >> /home/root/.ssh/config
|
||||||
|
chmod 600 /home/root/.ssh/config
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f /home/root/.ssh/truenas ]]
|
||||||
|
then
|
||||||
|
echo "-----BEGIN OPENSSH PRIVATE KEY-----" > /home/root/.ssh/truenas
|
||||||
|
echo "b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW" >> /home/root/.ssh/truenas
|
||||||
|
echo "QyNTUxOQAAACCDKl0DNjKWKlSpbCGeKjmA3tc0pKDvAiMfWQ83h0JVlQAAAJhNQ67sTUOu" >> /home/root/.ssh/truenas
|
||||||
|
echo "7AAAAAtzc2gtZWQyNTUxOQAAACCDKl0DNjKWKlSpbCGeKjmA3tc0pKDvAiMfWQ83h0JVlQ" >> /home/root/.ssh/truenas
|
||||||
|
echo "AAAEBoM2bsFqToHCHKO3F6MvOlObGaiNXw6UPcyBlyfbSAvYMqXQM2MpYqVKlsIZ4qOYDe" >> /home/root/.ssh/truenas
|
||||||
|
echo "1zSkoO8CIx9ZDzeHQlWVAAAAEWFrYW5lYWx3QExhcHRvcFBDAQIDBA==" >> /home/root/.ssh/truenas
|
||||||
|
echo "-----END OPENSSH PRIVATE KEY-----" >> /home/root/.ssh/truenas
|
||||||
|
chown root:root /home/root/.ssh/truenas
|
||||||
|
chmod 600 /home/root/.ssh/truenas
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user