Ping Test on configure input

This commit is contained in:
Michael Stanclift 2020-06-02 09:43:58 -05:00
parent 33632c04b6
commit 47d71fd821
2 changed files with 18 additions and 6 deletions

View File

@ -7,7 +7,7 @@ assignees: ''
--- ---
**Describe the bug** **Describe the Issue**
A clear and concise description of what the bug is. A clear and concise description of what the bug is.
**Screenshots** **Screenshots**
@ -21,5 +21,5 @@ If applicable, add screenshots to help explain your problem.
- Gravity Sync Version: [e.g. 1.7.6] - Gravity Sync Version: [e.g. 1.7.6]
- Pi-hole Versions: [e.g. v5.0] - Pi-hole Versions: [e.g. v5.0]
**Additional context** **Additional Context**
Add any other context about the problem here. If you have any advanced flags set in your `gravity-sync.conf` please list them here. Add any other context about the problem here. If you have any advanced flags set in your `gravity-sync.conf` please list them here.

View File

@ -28,6 +28,7 @@ CRONJOB_LOG='gravity-sync.cron' # replace in gravity-sync.conf to overwrite
VERIFY_PASS='0' # replace in gravity-sync.conf to overwrite 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
# Pi-hole Folder/File Locations # Pi-hole Folder/File Locations
PIHOLE_DIR='/etc/pihole' # default Pi-hole data directory PIHOLE_DIR='/etc/pihole' # default Pi-hole data directory
@ -702,7 +703,7 @@ function detect_ssh {
else else
echo_fail echo_fail
MESSAGE="RSYNC is Required" MESSAGE="RSYNC is Required"
echo_info echo_warn
distro_check distro_check
@ -857,6 +858,18 @@ function config_generate {
echo_need echo_need
read INPUT_REMOTE_HOST read INPUT_REMOTE_HOST
if [ "${PING_AVOID}" != "1" ]
MESSAGE="Testing Network Connection (PING)"
echo_stat
ping -c 3 ${INPUT_REMOTE_HOST}
if [ "$?" != "127" ]
then
echo_fail
else
echo_good
fi
fi
MESSAGE="Enter SSH user with SUDO rights on primary Pi-hole server" MESSAGE="Enter SSH user with SUDO rights on primary Pi-hole server"
echo_need echo_need
read INPUT_REMOTE_USER read INPUT_REMOTE_USER
@ -1323,10 +1336,9 @@ case $# in
if [ -f $HOME/${LOCAL_FOLDR}/${CONFIG_FILE} ] if [ -f $HOME/${LOCAL_FOLDR}/${CONFIG_FILE} ]
then then
config_delete config_delete
else else
MESSAGE="${CONFIG_FILE} Missing" MESSAGE="No Active ${CONFIG_FILE}"
echo_info echo_warn
config_generate config_generate
fi fi