41 lines
1.9 KiB
Bash
41 lines
1.9 KiB
Bash
#!/bin/bash
|
|
|
|
mkdir -p /root/scripts/restic
|
|
rm /root/scripts/restic/*
|
|
wget -q http://192.168.1.50/scripts/restic/restic-sftp/restic-sftp-backup.sh
|
|
wget -q http://192.168.1.50/scripts/restic/restic-sftp/export-etc.sh
|
|
wget -q http://192.168.1.50/scripts/restic/restic-sftp/export-home-akanealw.sh
|
|
wget -q http://192.168.1.50/scripts/restic/restic-sftp/export-opt.sh
|
|
wget -q http://192.168.1.50/scripts/restic/restic-sftp/export-root.sh
|
|
wget -q http://192.168.1.50/scripts/restic/restic-sftp/restic-sftp-init.sh
|
|
|
|
mv /root/restic-sftp-* /root/scripts/restic
|
|
mv /root/export-* /root/scripts/restic
|
|
chmod +x /root/scripts/restic/*
|
|
|
|
isInFile=$(cat /root/.ssh/config | grep -c "truenas")
|
|
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 "Port 22" >> /root/.ssh/config
|
|
echo "User akanealw" >> /root/.ssh/config
|
|
echo "IdentityFile ~/.ssh/truenas" >> /root/.ssh/config
|
|
echo "StrictHostKeyChecking no" >> /root/.ssh/config
|
|
chmod 600 /root/.ssh/config
|
|
fi
|
|
|
|
if [[ ! -f /root/.ssh/truenas ]]
|
|
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
|
|
fi
|