Update gravity-sync.sh

This commit is contained in:
Michael Stanclift 2020-05-23 18:37:08 -05:00
parent 75f2e5975b
commit 9f34aca8c6

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
# GRAVITY SYNC BY VMSTAN ##################### # GRAVITY SYNC BY VMSTAN #####################
PROGRAM='Gravity Sync'
VERSION='1.3.0' VERSION='1.3.0'
# Must execute from a location in the home folder of the user who own's it (ex: /home/pi/gravity-sync) # Must execute from a location in the home folder of the user who own's it (ex: /home/pi/gravity-sync)
@ -39,6 +40,7 @@ FAIL="[${RED}FAIL${NC}]"
WARN="[${PURPLE}WARN${NC}]" WARN="[${PURPLE}WARN${NC}]"
GOOD="[${GREEN}GOOD${NC}]" GOOD="[${GREEN}GOOD${NC}]"
STAT="[${CYAN}STAT${NC}]" STAT="[${CYAN}STAT${NC}]"
INFO="[${YELLOW}INFO${NC}]"
############################################## ##############################################
### DO NOT CHANGE ANYTHING BELOW THIS LINE ### ### DO NOT CHANGE ANYTHING BELOW THIS LINE ###
@ -112,7 +114,7 @@ function pull_gs {
# Push Function # Push Function
function push_gs { function push_gs {
TASKTYPE='PUSH' TASKTYPE='PUSH'
echo -e "[${PURPLE}WARN${NC}] DATA LOSS IS POSSIBLE" echo -e "${WARN} DATA LOSS IS POSSIBLE"
echo -e "The standard use of this script is to ${YELLOW}PULL${NC} data from the" echo -e "The standard use of this script is to ${YELLOW}PULL${NC} data from the"
echo -e "primary PH server to the secondary. By issuing a ${YELLOW}PUSH${NC}, we" echo -e "primary PH server to the secondary. By issuing a ${YELLOW}PUSH${NC}, we"
echo -e "will instead overwrite the ${GRAVITY_FI} on ${YELLOW}${REMOTE_HOST}${NC}" echo -e "will instead overwrite the ${GRAVITY_FI} on ${YELLOW}${REMOTE_HOST}${NC}"
@ -216,14 +218,14 @@ function list_gs_arguments {
# Exit Codes # Exit Codes
## No Changes Made ## No Changes Made
function exit_nochange { function exit_nochange {
echo -e "[${CYAN}STAT${NC}] Exiting Without Making Changes" echo -e "${INFO} ${PROGRAM} ${YELLOW}${TASKTYPE}${NC} Exiting Without Changes"
exit exit 0
} }
## Changes Made ## Changes Made
function exit_withchange { function exit_withchange {
echo -e "[${CYAN}STAT${NC}] ${GRAVITY_FI} ${TASKTYPE} Completed" echo -e "${GOOD} ${PROGRAM} ${YELLOW}${TASKTYPE}${NC} Completed"
exit exit 0
} }
# Error Validation # Error Validation
@ -238,6 +240,7 @@ function error_validate {
# SCRIPT EXECUTION ########################### # SCRIPT EXECUTION ###########################
echo -e "${INFO} ${PROGRAM} ${VERSION}"
echo -e "[${CYAN}STAT${NC}] Evaluating Script Arguments" echo -e "[${CYAN}STAT${NC}] Evaluating Script Arguments"
case $# in case $# in