mirror of
https://github.com/vmstan/gravity-sync.git
synced 2024-08-30 18:22:11 +00:00
2.1.6 beta 2 (#67)
* select different files for restore * star trek reference * Log backup jobs * color restore * ping avoid and custom ssh prompts * z variable * or * [] * new method for defaults * variables matter * or this? * making it specific * adv conf: add ROOT_CHECK_AVOID for container. (#64) * adv conf: add ROOT_CHECK_AVOID for container. import_gs only once at start * allow parameters for automation option Co-authored-by: Michael Stanclift <mstanclift@vmware.com> * Post PR cleanup * Thanks for fbourqui * readjusts import_gs Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> Co-authored-by: fbourqui <fbourqui@yahoo.com>
This commit is contained in:
committed by
GitHub
parent
6cb842a12b
commit
ba034a586c
21
ADVANCED.md
21
ADVANCED.md
@ -169,6 +169,11 @@ The `./gravity-sync.sh config` function will attempt to ping the remote host to
|
|||||||
|
|
||||||
Default setting in Gravity Sync is 0, change to 1 to skip this network test.
|
Default setting in Gravity Sync is 0, change to 1 to skip this network test.
|
||||||
|
|
||||||
|
#### `ROOT_CHECK_AVOID=''`
|
||||||
|
At execution, Gravity Sync will check that it's deployed with it's own user (not running as root), but for a container deployment this is not necessary.
|
||||||
|
|
||||||
|
Default setting in Gravity Sync is 0, change to 1 to skip this root user test.
|
||||||
|
|
||||||
#### `BACKUP_RETAIN=''`
|
#### `BACKUP_RETAIN=''`
|
||||||
The `./gravity-sync.sh backup` function will retain a defined number of days worth of `gravity.db` and `custom.list` backups.
|
The `./gravity-sync.sh backup` function will retain a defined number of days worth of `gravity.db` and `custom.list` backups.
|
||||||
|
|
||||||
@ -216,9 +221,23 @@ If you prefer to still use cron but modify your settings by hand, using the entr
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
crontab -e
|
crontab -e
|
||||||
*/30 * * * * /bin/bash /home/USER/gravity-sync/gravity-sync.sh > /home/USER/gravity-sync/gravity-sync.cron
|
*/15 * * * * /bin/bash /home/USER/gravity-sync/gravity-sync.sh > /home/USER/gravity-sync/gravity-sync.cron
|
||||||
|
0 23 * * * /bin/bash /home/USER//gravity-sync/gravity-sync.sh backup >/dev/null 2>&1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Automating Automation
|
||||||
|
|
||||||
|
To automate the deployment of automation option you can call it with 2 parameters:
|
||||||
|
- First interval in minutes to run sync [0-30],
|
||||||
|
- Second the hour to run backup [0-24]
|
||||||
|
|
||||||
|
(0 will disable the cron entry)
|
||||||
|
|
||||||
|
For example:
|
||||||
|
`./gravity-sync.sh automate 15 23`
|
||||||
|
|
||||||
|
Will configure automation of the sync function every 15 minutes and of a backup at 23:00.
|
||||||
|
|
||||||
## Reference Architectures
|
## Reference Architectures
|
||||||
The designation of primary and secondary is purely at your discretion. The doesn't matter if you're using an HA process like keepalived to present a single DNS IP address to clients, or handing out two DNS resolvers via DHCP. Generally it is expected that the two (or more) Pi-hole(s) will be at the same phyiscal location, or at least on the same internal networks. It should also be possible to to replicate to a secondary Pi-hole across networks, either over a VPN or open-Internet, with the approprate firewall/NAT configuration.
|
The designation of primary and secondary is purely at your discretion. The doesn't matter if you're using an HA process like keepalived to present a single DNS IP address to clients, or handing out two DNS resolvers via DHCP. Generally it is expected that the two (or more) Pi-hole(s) will be at the same phyiscal location, or at least on the same internal networks. It should also be possible to to replicate to a secondary Pi-hole across networks, either over a VPN or open-Internet, with the approprate firewall/NAT configuration.
|
||||||
|
|
||||||
|
@ -36,6 +36,10 @@ Skipping a few digits because what does it really matter?
|
|||||||
|
|
||||||
#### 2.1.6
|
#### 2.1.6
|
||||||
- Adds prompts during `./gravity-sync.sh configure` to allow custom SSH port and enable PING avoidance.
|
- Adds prompts during `./gravity-sync.sh configure` to allow custom SSH port and enable PING avoidance.
|
||||||
|
- Adds `ROOT_CHECK_AVOID` variable to advanced configuration options, to help facilitate running Gravity Sync with container installations of Pi-hole. (PR [#64](https://github.com/vmstan/gravity-sync/pull/64))
|
||||||
|
- Adds the ability to automate automation. :mind_blown_emoji: Please see the ADVANCED.md document for more information. (PR [#64](https://github.com/vmstan/gravity-sync/pull/64))
|
||||||
|
|
||||||
|
(Thanks to [@fbourqui](https://github.com/fbourqui) for this contributions to this release.)
|
||||||
|
|
||||||
## 2.0
|
## 2.0
|
||||||
### The Smart Release
|
### The Smart Release
|
||||||
|
@ -33,5 +33,6 @@ REMOTE_PASS=''
|
|||||||
# SKIP_CUSTOM=''
|
# SKIP_CUSTOM=''
|
||||||
# DATE_OUTPUT=''
|
# DATE_OUTPUT=''
|
||||||
# PING_AVOID=''
|
# PING_AVOID=''
|
||||||
|
# ROOT_CHECK_AVOID=''
|
||||||
|
|
||||||
# BACKUP_RETAIN=''
|
# BACKUP_RETAIN=''
|
@ -31,6 +31,7 @@ VERIFY_PASS='0' # replace in gravity-sync.conf to overwrite
|
|||||||
SKIP_CUSTOM='0' # replace in gravity-sync.conf to overwrite
|
SKIP_CUSTOM='0' # replace in gravity-sync.conf to overwrite
|
||||||
DATE_OUTPUT='0' # replace in gravity-sync.conf to overwrite
|
DATE_OUTPUT='0' # replace in gravity-sync.conf to overwrite
|
||||||
PING_AVOID='0' # replace in gravity-sync.conf to overwrite
|
PING_AVOID='0' # replace in gravity-sync.conf to overwrite
|
||||||
|
ROOT_CHECK_AVOID='0' # replace in gravity-sync.conf to overwrite
|
||||||
|
|
||||||
# Backup Customization
|
# Backup Customization
|
||||||
BACKUP_RETAIN='7' # replace in gravity-sync.conf to overwrite
|
BACKUP_RETAIN='7' # replace in gravity-sync.conf to overwrite
|
||||||
@ -1624,9 +1625,14 @@ function task_automate {
|
|||||||
MESSAGE="Configuring Hourly Smart Sync"
|
MESSAGE="Configuring Hourly Smart Sync"
|
||||||
echo_info
|
echo_info
|
||||||
|
|
||||||
MESSAGE="Sync Frequency in Minutes (1-30) or 0 to Disable"
|
if [[ $1 =~ ^[0-9][0-9]?$ ]]
|
||||||
echo_need
|
then
|
||||||
read INPUT_AUTO_FREQ
|
INPUT_AUTO_FREQ=$1
|
||||||
|
else
|
||||||
|
MESSAGE="Sync Frequency in Minutes (1-30) or 0 to Disable"
|
||||||
|
echo_need
|
||||||
|
read INPUT_AUTO_FREQ
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $INPUT_AUTO_FREQ -gt 30 ]
|
if [ $INPUT_AUTO_FREQ -gt 30 ]
|
||||||
then
|
then
|
||||||
@ -1660,9 +1666,14 @@ function task_automate {
|
|||||||
MESSAGE="Configuring Daily Backup Frequency"
|
MESSAGE="Configuring Daily Backup Frequency"
|
||||||
echo_info
|
echo_info
|
||||||
|
|
||||||
MESSAGE="Hour of Day to Backup (1-24) or 0 to Disable"
|
if [[ $2 =~ ^[0-9][0-9]?$ ]]
|
||||||
echo_need
|
then
|
||||||
read INPUT_AUTO_BACKUP
|
INPUT_AUTO_BACKUP=$2
|
||||||
|
else
|
||||||
|
MESSAGE="Hour of Day to Backup (1-24) or 0 to Disable"
|
||||||
|
echo_need
|
||||||
|
read INPUT_AUTO_BACKUP
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $INPUT_AUTO_BACKUP -gt 24 ]
|
if [ $INPUT_AUTO_BACKUP -gt 24 ]
|
||||||
then
|
then
|
||||||
@ -1820,8 +1831,9 @@ function task_compare {
|
|||||||
TASKTYPE='COMPARE'
|
TASKTYPE='COMPARE'
|
||||||
MESSAGE="${MESSAGE}: ${TASKTYPE} Requested"
|
MESSAGE="${MESSAGE}: ${TASKTYPE} Requested"
|
||||||
echo_good
|
echo_good
|
||||||
|
|
||||||
import_gs
|
import_gs
|
||||||
|
|
||||||
validate_gs_folders
|
validate_gs_folders
|
||||||
validate_ph_folders
|
validate_ph_folders
|
||||||
validate_os_sshpass
|
validate_os_sshpass
|
||||||
@ -1971,7 +1983,10 @@ function root_check {
|
|||||||
MESSAGE="Evaluating Arguments"
|
MESSAGE="Evaluating Arguments"
|
||||||
echo_stat
|
echo_stat
|
||||||
|
|
||||||
root_check
|
if [ "${ROOT_CHECK_AVOID}" != "1" ]
|
||||||
|
then
|
||||||
|
root_check
|
||||||
|
fi
|
||||||
|
|
||||||
case $# in
|
case $# in
|
||||||
|
|
||||||
@ -2023,7 +2038,7 @@ case $# in
|
|||||||
TASKTYPE='PULL'
|
TASKTYPE='PULL'
|
||||||
MESSAGE="${MESSAGE}: ${TASKTYPE} Requested"
|
MESSAGE="${MESSAGE}: ${TASKTYPE} Requested"
|
||||||
echo_good
|
echo_good
|
||||||
|
|
||||||
import_gs
|
import_gs
|
||||||
validate_gs_folders
|
validate_gs_folders
|
||||||
validate_ph_folders
|
validate_ph_folders
|
||||||
@ -2037,7 +2052,7 @@ case $# in
|
|||||||
TASKTYPE='PUSH'
|
TASKTYPE='PUSH'
|
||||||
MESSAGE="${MESSAGE}: ${TASKTYPE} Requested"
|
MESSAGE="${MESSAGE}: ${TASKTYPE} Requested"
|
||||||
echo_good
|
echo_good
|
||||||
|
|
||||||
import_gs
|
import_gs
|
||||||
validate_gs_folders
|
validate_gs_folders
|
||||||
validate_ph_folders
|
validate_ph_folders
|
||||||
@ -2125,6 +2140,24 @@ case $# in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
2)
|
||||||
|
case $1 in
|
||||||
|
automate)
|
||||||
|
task_automate
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
|
||||||
|
3)
|
||||||
|
case $1 in
|
||||||
|
automate)
|
||||||
|
task_automate $2 $3
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
task_invalid
|
task_invalid
|
||||||
|
Reference in New Issue
Block a user