mirror of
https://github.com/vmstan/gravity-sync.git
synced 2024-08-30 18:22:11 +00:00
restore function
This commit is contained in:
parent
958aa017f8
commit
a284d3b4d2
@ -3,7 +3,9 @@
|
|||||||
## 2.1
|
## 2.1
|
||||||
### The Backup Release
|
### The Backup Release
|
||||||
|
|
||||||
A new function `./gravity-sync.sh backup` will now perform a sqlite operated backup of the `gravity.db` on the local Pi-hole.
|
A new function `./gravity-sync.sh backup` will now perform a sqlite operated backup of the `gravity.db` on the local Pi-hole. This can be run at any time you wish, but can also be automated by the `./gravity-sync.sh automate` function to run once a day. New and existing users will be prompted to configure both during this task. If can also disable both using the automate function, or just automate one or the other, by setting the value to `0` during setup.
|
||||||
|
|
||||||
|
By default, 7 days worth of backups will be retained in the `backup` folder. You can adjust the retention length by changing the `BACKUP_RETAIN` function in your `gravity-sync.conf` file. See the `ADVANCED.md` file for more information on setting these custom configuration options.
|
||||||
|
|
||||||
## 2.0
|
## 2.0
|
||||||
### The Smart Release
|
### The Smart Release
|
||||||
|
@ -529,14 +529,36 @@ function smart_gs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function restore_gs {
|
function restore_gs {
|
||||||
MESSAGE="This will restore ${GRAVITY_FI} on $HOSTNAME with the previous version!"
|
MESSAGE="This will restore your settings on $HOSTNAME with a previous version!"
|
||||||
echo_warn
|
echo_warn
|
||||||
|
|
||||||
|
MESSAGE="PREVIOUS BACKUPS"
|
||||||
|
echo_info
|
||||||
|
ls $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD} | grep $(date +%Y) | grep ${GRAVITY_FI} | colrm 18
|
||||||
|
|
||||||
|
MESSAGE="Enter the date you want to restore from"
|
||||||
|
echo_need
|
||||||
|
read INPUT_BACKUP_DATE
|
||||||
|
|
||||||
|
if [ -f $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${INPUT_BACKUP_DATE}-${GRAVITY_FI}.backup ]
|
||||||
|
then
|
||||||
|
MESSAGE="Backup File Located"
|
||||||
|
echo_info
|
||||||
|
else
|
||||||
|
MESSAGE="Invalid Requested"
|
||||||
|
fi
|
||||||
|
|
||||||
intent_validate
|
intent_validate
|
||||||
|
|
||||||
|
MESSAGE="Stopping Pi-hole Services"
|
||||||
|
echo_stat
|
||||||
|
|
||||||
|
sudo service pihole-FTL stop >/dev/null 2>&1
|
||||||
|
error_validate
|
||||||
|
|
||||||
MESSAGE="Restoring ${GRAVITY_FI} on $HOSTNAME"
|
MESSAGE="Restoring ${GRAVITY_FI} on $HOSTNAME"
|
||||||
echo_stat
|
echo_stat
|
||||||
sudo cp $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.backup ${PIHOLE_DIR}/${GRAVITY_FI} >/dev/null 2>&1
|
sudo cp $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${INPUT_BACKUP_DATE}-${GRAVITY_FI}.backup ${PIHOLE_DIR}/${GRAVITY_FI} >/dev/null 2>&1
|
||||||
error_validate
|
error_validate
|
||||||
|
|
||||||
MESSAGE="Validating Ownership on ${GRAVITY_FI}"
|
MESSAGE="Validating Ownership on ${GRAVITY_FI}"
|
||||||
@ -579,11 +601,11 @@ function restore_gs {
|
|||||||
|
|
||||||
if [ "$SKIP_CUSTOM" != '1' ]
|
if [ "$SKIP_CUSTOM" != '1' ]
|
||||||
then
|
then
|
||||||
if [ -f $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${CUSTOM_DNS}.backup ]
|
if [ -f $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${INPUT_BACKUP_DATE}-${CUSTOM_DNS}.backup ]
|
||||||
then
|
then
|
||||||
MESSAGE="Restoring ${CUSTOM_DNS} on $HOSTNAME"
|
MESSAGE="Restoring ${CUSTOM_DNS} on $HOSTNAME"
|
||||||
echo_stat
|
echo_stat
|
||||||
sudo cp $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${CUSTOM_DNS}.backup ${PIHOLE_DIR}/${CUSTOM_DNS} >/dev/null 2>&1
|
sudo cp $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${INPUT_BACKUP_DATE}-${CUSTOM_DNS}.backup ${PIHOLE_DIR}/${CUSTOM_DNS} >/dev/null 2>&1
|
||||||
error_validate
|
error_validate
|
||||||
|
|
||||||
MESSAGE="Validating Ownership on ${CUSTOM_DNS}"
|
MESSAGE="Validating Ownership on ${CUSTOM_DNS}"
|
||||||
@ -630,16 +652,16 @@ function restore_gs {
|
|||||||
echo_info
|
echo_info
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
|
MESSAGE="Restarting FTLDNS Services"
|
||||||
|
echo_stat
|
||||||
|
sudo service pihole-FTL start >/dev/null 2>&1
|
||||||
|
error_validate
|
||||||
|
|
||||||
MESSAGE="Updating FTLDNS Configuration"
|
MESSAGE="Updating FTLDNS Configuration"
|
||||||
echo_stat
|
echo_stat
|
||||||
${PIHOLE_BIN} restartdns reloadlists >/dev/null 2>&1
|
${PIHOLE_BIN} restartdns reloadlists >/dev/null 2>&1
|
||||||
error_validate
|
error_validate
|
||||||
|
|
||||||
MESSAGE="Reloading FTLDNS Services"
|
|
||||||
echo_stat
|
|
||||||
${PIHOLE_BIN} restartdns >/dev/null 2>&1
|
|
||||||
error_validate
|
|
||||||
|
|
||||||
logs_export
|
logs_export
|
||||||
exit_withchange
|
exit_withchange
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user