Testing backup and restore scripts

This commit is contained in:
tb14
2019-12-18 02:12:02 -08:00
parent 72a3e238ee
commit 537c255c75
3 changed files with 79 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
/etc/ssh/sshd_config
/etc/wpa_supplicant/wpa_supplicant.conf
/etc/hosts
/etc/hostname
/etc/chrony/
/etc/dhcpcd.conf
/etc/ntp.conf
/etc/udev/rules.d/
/home/pi/.ssh/authorized_keys
/home/pi/.ssh/config
/home/pi/.config/
/home/pi/garim/
/home/pi/.nbems/
/home/pi/.fldigi/
/home/pi/.wl2k/
/home/pi/.conkyrc
/home/pi/.flrig/
/home/pi/.gnupg/
/home/pi/.gtktermrc
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
NOW=$(date +"%m-%d-%Y")
FILE="backup.$NOW.tar.bz"
echo "This script will backup the files and directories listed in $HOME/setup-scripts/backup/backup-list.txt"
echo
echo "The resulting compressed .tar.bz file can be used to restore most of your system's configuration settings after a fresh install."
echo
echo "Would you like to continue?"
echo
select yn in "Yes" "No"; do
case $yn in
Yes )
tar -cvjf $FILE -T $HOME/setup-scripts/backup/backup-list.txt
break;;
No ) break;;
esac
done
+41
View File
@@ -0,0 +1,41 @@
#!/bin/bash
NOW=$(date +"%m-%d-%Y")
FILE=$1
if [[ -z ${1} ]]; then
echo "You must supply the full path to your backup file you with to restore."
echo
echo
echo "e.g. ./restore.sh /home/pi/setup-scripts/backups/backup.12-19-2019.tar.bz"
exit 0
else
clear
echo
echo
echo "WARNING: THIS WILL OVERWRITE YOUR SYSTEM WITH THE FILES FROM ${1}."
echo
echo
echo
echo "Do you wish to continue?"
select yn in "Yes" "No"; do
case $yn in
Yes ) sleep 1
echo
echo
echo "Restoring ${1}...."
echo
echo
sleep 2
tar -xvjf $FILE -C /tmp/testing || echo "A problem occured while extracting your backup"
echo
echo "${1} has been restored"
echo
sleep 1
break;;
No ) break;;
esac
done
fi