gravity-sync/includes/gs-exit.sh
Michael Stanclift 73ffc9eef1
3.4.6 (#244)
* Delete all backups

* Remove push/pull files

* Maybe rusty on my Bash

* Don't delete backups if running a backup job

* AND THEN

* different if style

* Just don't delete anything

* Change messages

* BACKUP

* exempt cleanup from backup task

* deactivate sameline

* remove sameline

* Cleanup samelines

* More cleanup

* More sameline cleanup

* Increase timeout

* 3.4.6

* Variables not marked

* MATH

* MATH?

* more math in more places

* NEW MATH

* MAAAAATH

* I don't even know

* Keep trying

* PLEASE

* PLEASE

* Too many tested variables finally worked

* Add backup integrity wait

* silent_error_validate

* silent_error_validate removal
2021-09-07 12:24:36 -05:00

66 lines
2.8 KiB
Bash

# GRAVITY SYNC BY VMSTAN #####################
# gs-exit.sh #################################
# For documentation or downloading updates visit https://github.com/vmstan/gravity-sync
# This code is called from the main gravity-sync.sh file and should not execute directly!
## No Changes Made
function exit_nochange {
SCRIPT_END=$SECONDS
let SCRIPT_RUN=SCRIPT_END-SCRIPT_START
if [ "${TASKTYPE}" == "" ]
then
MESSAGE="${PROGRAM} ${UI_EXIT_ABORT} ${UI_EXIT_CALC_END} ${SCRIPT_RUN} ${UI_EXIT_CALC_TIMER}"
else
MESSAGE="${PROGRAM} ${TASKTYPE} ${UI_EXIT_ABORT} ${UI_EXIT_CALC_END} ${SCRIPT_RUN} ${UI_EXIT_CALC_TIMER}"
fi
echo_grav
exit 0
}
## Changes Made
function exit_withchange {
SCRIPT_END=$SECONDS
let SCRIPT_RUN=SCRIPT_END-SCRIPT_START
if [ "${TASKTYPE}" == "" ]
then
MESSAGE="${PROGRAM} ${UI_EXIT_COMPLETE} ${UI_EXIT_CALC_END} ${SCRIPT_RUN} ${UI_EXIT_CALC_TIMER}"
else
MESSAGE="${PROGRAM} ${TASKTYPE} ${UI_EXIT_COMPLETE} ${UI_EXIT_CALC_END} ${SCRIPT_RUN} ${UI_EXIT_CALC_TIMER}"
fi
echo_grav
exit 0
}
## List GS Arguments
function list_gs_arguments {
echo -e "Usage: $0 [options]"
echo -e "Example: '$0 pull'"
echo_lines
echo -e "Setup Options:"
echo -e " ${YELLOW}config${NC} Creates a new ${PROGRAM} configuration file"
echo -e " ${YELLOW}automate${NC} Schedules the ${PROGRAM} replication task using crontab"
echo -e " ${YELLOW}version${NC} Shows the installed version of ${PROGRAM} and check for updates"
echo -e " ${YELLOW}update${NC} Upgrades ${PROGRAM} to the latest available version using Git"
echo -e " ${YELLOW}dev${NC} Sets update command to use a development version of ${PROGRAM}"
echo -e " ${YELLOW}sudo${NC} Configures passwordless sudo for current user"
echo_blank
echo -e "Replication Options:"
echo -e " ${YELLOW}smart${NC} Detects Pi-hole changes on primary and secondary and then combines them"
echo -e " ${YELLOW}pull${NC} Brings the remote Pi-hole configuration to this server"
echo -e " ${YELLOW}push${NC} Sends the local Pi-hole configuration to the primary"
echo -e " ${YELLOW}compare${NC} Just checks for Pi-hole differences at each side without making changes"
echo -e " ${YELLOW}restore${NC} Restores the Pi-hole configuration on this server"
echo -e " ${YELLOW}backup${NC} Just backs up the Pi-hole on this server"
echo_blank
echo -e "Debug Options:"
echo -e " ${YELLOW}logs${NC} Shows the recent successful replication jobs/times"
echo -e " ${YELLOW}cron${NC} Displays the output of last crontab execution"
echo -e " ${YELLOW}info${NC} Shows information about the current configuration"
echo_lines
exit_nochange
}