Less chatty during validation

This commit is contained in:
Michael Stanclift 2020-06-02 11:03:57 -05:00
parent eb864a614b
commit abc3273f55
2 changed files with 27 additions and 10 deletions

View File

@ -16,6 +16,8 @@
- Changes some [INFO] messages to [WARN] where approprate - Changes some [INFO] messages to [WARN] where approprate
- Adds aliases for more GS functions - Adds aliases for more GS functions
- Shows current version on each script execution - Shows current version on each script execution
- Adds time output to Aborting message (exit without change)
- Checks for existance of Pi-hole binaries during validation
#### 1.7.6 #### 1.7.6
- Detects `dbclient` install as alternative to OpenSSH Client. - Detects `dbclient` install as alternative to OpenSSH Client.

View File

@ -529,38 +529,52 @@ function show_crontab {
# Validate Functions # Validate Functions
## Validate GS Folders ## Validate GS Folders
function validate_gs_folders { function validate_gs_folders {
MESSAGE="Validating $HOSTNAME:$HOME/${LOCAL_FOLDR}" MESSAGE="Validating ${PROGRAM} Folders on $HOSTNAME"
echo_stat echo_stat
if [ -d $HOME/${LOCAL_FOLDR} ] if [ -d $HOME/${LOCAL_FOLDR} ]
then then
echo_good
else else
MESSAGE="Unable to Find $HOME/${LOCAL_FOLDR}"
echo_fail echo_fail
exit_nochange exit_nochange
fi fi
MESSAGE="Validating $HOSTNAME:$HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}"
echo_stat
if [ -d $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD} ] if [ -d $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD} ]
then then
echo_good
else else
MESSAGE="Unable to Find $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}"
echo_fail echo_fail
exit_nochange exit_nochange
fi fi
echo_good
} }
## Validate Pi-hole Folders ## Validate Pi-hole Folders
function validate_ph_folders { function validate_ph_folders {
MESSAGE="Validating $HOSTNAME:${PIHOLE_DIR}" MESSAGE="Validating Pi-hole Configuration on $HOSTNAME"
echo_stat echo_stat
if [ -d ${PIHOLE_DIR} ] if [ -f ${PIHOLE_BIN} ]
then then
echo_good
else else
MESSAGE="Unable to Validate Pi-Hole is Installed"
echo_fail echo_fail
exit_nochange exit_nochange
fi fi
if [ -d ${PIHOLE_DIR} ]
then
else
MESSAGE="Unable to Validate Pi-Hole Configuration Directory"
echo_fail
exit_nochange
fi
echo_good
} }
## Validate SSHPASS ## Validate SSHPASS
@ -1002,7 +1016,8 @@ function config_delete {
# Exit Codes # Exit Codes
## No Changes Made ## No Changes Made
function exit_nochange { function exit_nochange {
MESSAGE="${PROGRAM} ${TASKTYPE} Aborting" SCRIPT_END=$SECONDS
MESSAGE="${PROGRAM} ${TASKTYPE} Aborting ($((SCRIPT_END-SCRIPT_START)) seconds)"
echo_info echo_info
exit 0 exit 0
} }
@ -1010,7 +1025,7 @@ function exit_nochange {
## Changes Made ## Changes Made
function exit_withchange { function exit_withchange {
SCRIPT_END=$SECONDS SCRIPT_END=$SECONDS
MESSAGE="${PROGRAM} ${TASKTYPE} Completed in $((SCRIPT_END-SCRIPT_START)) seconds" MESSAGE="${PROGRAM} ${TASKTYPE} Completed ($((SCRIPT_END-SCRIPT_START)) seconds)"
echo_info echo_info
exit 0 exit 0
} }