mirror of
https://github.com/vmstan/gravity-sync.git
synced 2024-08-30 18:22:11 +00:00
Testing command validation
This commit is contained in:
parent
20963f2f71
commit
f2e235c88d
@ -69,6 +69,7 @@ function pull_gs {
|
||||
TASKTYPE='PULL'
|
||||
echo -e "[${CYAN}STAT${NC}] Pulling ${GRAVITY_FI} from ${REMOTE_HOST}"
|
||||
rsync -v -e 'ssh -p 22' ${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${GRAVITY_FI} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.pull
|
||||
if_validate
|
||||
echo -e "[${CYAN}STAT${NC}] Backing Up Current ${GRAVITY_FI} on $HOSTNAME"
|
||||
cp -v ${PIHOLE_DIR}/${GRAVITY_FI} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.backup
|
||||
echo -e "[${CYAN}STAT${NC}] Replacing ${GRAVITY_FI} on $HOSTNAME"
|
||||
@ -200,6 +201,13 @@ function exit_withchange {
|
||||
exit
|
||||
}
|
||||
|
||||
function if_validate {
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "[${RED}FAIL${NC}] Previous Command Failed"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# SCRIPT EXECUTION ###########################
|
||||
|
||||
echo -e "[${CYAN}STAT${NC}] Evaluating Script Arguments"
|
||||
|
Loading…
Reference in New Issue
Block a user