mirror of
https://github.com/vmstan/gravity-sync.git
synced 2024-08-30 18:22:11 +00:00
3.4.2 (#187)
* Add backup timeout customization * Different variable * remote integrity check * 3.4.2 * AND THEN * words * more words * Add local backup integrity * check local backup integrity * Clarify duplicate backup verbage * pulling Co-authored-by: Michael Stanclift <vmstan@ms-constitution.local>
This commit is contained in:
parent
71fdb016bd
commit
d07e492a97
@ -3,8 +3,7 @@ SCRIPT_START=$SECONDS
|
|||||||
|
|
||||||
# GRAVITY SYNC BY VMSTAN #####################
|
# GRAVITY SYNC BY VMSTAN #####################
|
||||||
PROGRAM='Gravity Sync'
|
PROGRAM='Gravity Sync'
|
||||||
VERSION='3.4.1'
|
VERSION='3.4.2'
|
||||||
|
|
||||||
|
|
||||||
# For documentation or downloading updates visit https://github.com/vmstan/gravity-sync
|
# For documentation or downloading updates visit https://github.com/vmstan/gravity-sync
|
||||||
# Requires Pi-Hole 5.x or higher already be installed, for help visit https://pi-hole.net
|
# Requires Pi-Hole 5.x or higher already be installed, for help visit https://pi-hole.net
|
||||||
|
@ -12,6 +12,7 @@ function task_backup() {
|
|||||||
|
|
||||||
backup_settime
|
backup_settime
|
||||||
backup_local_gravity
|
backup_local_gravity
|
||||||
|
backup_local_gravity_integrity
|
||||||
backup_local_custom
|
backup_local_custom
|
||||||
backup_local_cname
|
backup_local_cname
|
||||||
backup_cleanup
|
backup_cleanup
|
||||||
@ -32,6 +33,22 @@ function backup_local_gravity() {
|
|||||||
error_validate
|
error_validate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function backup_local_gravity_integrity() {
|
||||||
|
MESSAGE="${UI_BACKUP_INTEGRITY}"
|
||||||
|
echo_stat
|
||||||
|
|
||||||
|
secondaryIntegrity=$(sqlite3 ${LOCAL_FOLDR}/${BACKUP_FOLD}/${BACKUPTIMESTAMP}-${GRAVITY_FI}.backup 'PRAGMA integrity_check;' | sed 's/\s.*$//')
|
||||||
|
error_validate
|
||||||
|
|
||||||
|
if [ "$secondaryIntegrity" != 'ok' ]
|
||||||
|
then
|
||||||
|
MESSAGE="${UI_BACKUP_INTEGRITY_FAILED} ${UI_GRAVITY_NAME}"
|
||||||
|
echo_fail
|
||||||
|
|
||||||
|
exit_nochange
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function backup_local_custom() {
|
function backup_local_custom() {
|
||||||
if [ "$SKIP_CUSTOM" != '1' ]
|
if [ "$SKIP_CUSTOM" != '1' ]
|
||||||
then
|
then
|
||||||
@ -75,6 +92,22 @@ function backup_remote_gravity() {
|
|||||||
create_sshcmd
|
create_sshcmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function backup_remote_gravity_integrity() {
|
||||||
|
MESSAGE="${UI_BACKUP_INTEGRITY}"
|
||||||
|
echo_stat
|
||||||
|
|
||||||
|
primaryIntegrity=$(${SSHPASSWORD} ${SSH_CMD} -p ${SSH_PORT} -i "$HOME/${SSH_PKIF}" ${REMOTE_USER}@${REMOTE_HOST} "sqlite3 ${RIHOLE_DIR}/${GRAVITY_FI}.backup 'PRAGMA integrity_check;'" | sed 's/\s.*$//')
|
||||||
|
error_validate
|
||||||
|
|
||||||
|
if [ "$primaryIntegrity" != 'ok' ]
|
||||||
|
then
|
||||||
|
MESSAGE="${UI_BACKUP_INTEGRITY_FAILED} ${UI_GRAVITY_NAME}"
|
||||||
|
echo_fail
|
||||||
|
|
||||||
|
exit_nochange
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function backup_remote_custom() {
|
function backup_remote_custom() {
|
||||||
if [ "$SKIP_CUSTOM" != '1' ]
|
if [ "$SKIP_CUSTOM" != '1' ]
|
||||||
then
|
then
|
||||||
|
@ -31,6 +31,7 @@ function pull_gs_grav {
|
|||||||
|
|
||||||
backup_local_gravity
|
backup_local_gravity
|
||||||
backup_remote_gravity
|
backup_remote_gravity
|
||||||
|
backup_remote_gravity_integrity
|
||||||
|
|
||||||
MESSAGE="${UI_PULL_PRIMARY} ${UI_GRAVITY_NAME}"
|
MESSAGE="${UI_PULL_PRIMARY} ${UI_GRAVITY_NAME}"
|
||||||
echo_stat
|
echo_stat
|
||||||
|
@ -30,8 +30,9 @@ function task_push {
|
|||||||
function push_gs_grav {
|
function push_gs_grav {
|
||||||
backup_remote_gravity
|
backup_remote_gravity
|
||||||
backup_local_gravity
|
backup_local_gravity
|
||||||
|
backup_local_gravity_integrity
|
||||||
|
|
||||||
MESSAGE="${UI_BACKUP_PRIMARY} ${UI_GRAVITY_NAME}"
|
MESSAGE="${UI_BACKUP_COPY} ${UI_GRAVITY_NAME}"
|
||||||
echo_stat
|
echo_stat
|
||||||
RSYNC_REPATH="rsync"
|
RSYNC_REPATH="rsync"
|
||||||
RSYNC_SOURCE="${REMOTE_USER}@${REMOTE_HOST}:${RIHOLE_DIR}/${GRAVITY_FI}.backup"
|
RSYNC_SOURCE="${REMOTE_USER}@${REMOTE_HOST}:${RIHOLE_DIR}/${GRAVITY_FI}.backup"
|
||||||
@ -67,7 +68,7 @@ function push_gs_cust {
|
|||||||
backup_remote_custom
|
backup_remote_custom
|
||||||
backup_local_custom
|
backup_local_custom
|
||||||
|
|
||||||
MESSAGE="${UI_BACKUP_PRIMARY} ${UI_CUSTOM_NAME}"
|
MESSAGE="${UI_BACKUP_COPY} ${UI_CUSTOM_NAME}"
|
||||||
echo_stat
|
echo_stat
|
||||||
RSYNC_REPATH="rsync"
|
RSYNC_REPATH="rsync"
|
||||||
RSYNC_SOURCE="${REMOTE_USER}@${REMOTE_HOST}:${RIHOLE_DIR}/${CUSTOM_DNS}.backup"
|
RSYNC_SOURCE="${REMOTE_USER}@${REMOTE_HOST}:${RIHOLE_DIR}/${CUSTOM_DNS}.backup"
|
||||||
@ -105,7 +106,7 @@ function push_gs_cname {
|
|||||||
backup_remote_cname
|
backup_remote_cname
|
||||||
backup_local_cname
|
backup_local_cname
|
||||||
|
|
||||||
MESSAGE="${UI_BACKUP_PRIMARY} ${UI_CNAME_NAME}"
|
MESSAGE="${UI_BACKUP_COPY} ${UI_CNAME_NAME}"
|
||||||
echo_stat
|
echo_stat
|
||||||
RSYNC_REPATH="rsync"
|
RSYNC_REPATH="rsync"
|
||||||
RSYNC_SOURCE="${REMOTE_USER}@${REMOTE_HOST}:${RIHOLE_DIR}/dnsmasq.d-${CNAME_CONF}.backup"
|
RSYNC_SOURCE="${REMOTE_USER}@${REMOTE_HOST}:${RIHOLE_DIR}/dnsmasq.d-${CNAME_CONF}.backup"
|
||||||
|
@ -77,9 +77,12 @@ UI_LOGGING_RECENT_COMPLETE='Recent complete executions of'
|
|||||||
|
|
||||||
# Backup
|
# Backup
|
||||||
UI_BACKUP_PRIMARY='Performing backup of primary'
|
UI_BACKUP_PRIMARY='Performing backup of primary'
|
||||||
|
UI_BACKUP_COPY='Pulling backup of primary'
|
||||||
UI_BACKUP_SECONDARY='Performing backup of secondary'
|
UI_BACKUP_SECONDARY='Performing backup of secondary'
|
||||||
UI_BACKUP_PURGE='Purging redundant backups on secondary Pi-hole instance'
|
UI_BACKUP_PURGE='Purging redundant backups on secondary Pi-hole instance'
|
||||||
UI_BACKUP_REMAIN='days of backups remain'
|
UI_BACKUP_REMAIN='days of backups remain'
|
||||||
|
UI_BACKUP_INTEGRITY="Checking ${UI_GRAVITY_NAME} backup integrity"
|
||||||
|
UI_BACKUP_INTEGRITY_FAILED='Integrity check has failed for the primary'
|
||||||
|
|
||||||
# Restore
|
# Restore
|
||||||
UI_RESTORE_WARNING="This will overwrite your current Pi-hole settings on $HOSTNAME with a previous version!"
|
UI_RESTORE_WARNING="This will overwrite your current Pi-hole settings on $HOSTNAME with a previous version!"
|
||||||
|
Loading…
Reference in New Issue
Block a user