gravity-sync/includes/gs-exit.sh
Michael Stanclift ff32465625
3.7.0 (#315)
* add path removal to clear_cron

* 3.6.4

* add local folder to path

* templates for systemd timers

* Wantedby

* user root

* Gonna be 3.7

* Remove legacy cron code from automate function

* Core for moving replication jobs into place

* Move stop before copy

* Add Gravity Sync messages

* Service file customization

* Line break

* 10 minutes to sudo

* if active else

* Do things quietly

* Custom exec path

* clear exec start

* warning about cron

* no longer exists
2022-03-29 16:11:00 -05:00

64 lines
2.6 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 systemd"
echo -e " ${YELLOW}cron${NC} Schedules the ${PROGRAM} replication task using crontab (legacy)"
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_blank
echo -e "Debug Options:"
echo -e " ${YELLOW}logs${NC} Shows the recent successful replication jobs/times"
echo -e " ${YELLOW}info${NC} Shows information about the current configuration"
echo_lines
exit_nochange
}