mirror of
https://github.com/vmstan/gravity-sync.git
synced 2024-08-30 18:22:11 +00:00
Rebuilt pull in new style
This commit is contained in:
parent
dfc892e77e
commit
75f2e5975b
@ -77,19 +77,35 @@ function pull_gs {
|
|||||||
MESSAGE="Pulling ${GRAVITY_FI} from ${REMOTE_HOST}"
|
MESSAGE="Pulling ${GRAVITY_FI} from ${REMOTE_HOST}"
|
||||||
echo -e "${STAT} ${MESSAGE}"
|
echo -e "${STAT} ${MESSAGE}"
|
||||||
rsync -v -e 'ssh -p 22' ${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${GRAVITY_FI} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.pull
|
rsync -v -e 'ssh -p 22' ${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${GRAVITY_FI} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.pull
|
||||||
if_validate
|
error_validate
|
||||||
|
|
||||||
echo -e "[${CYAN}STAT${NC}] Backing Up Current ${GRAVITY_FI} on $HOSTNAME"
|
MESSAGE="Backing Up ${GRAVITY_FI} on $HOSTNAME"
|
||||||
|
echo -e "${STAT} ${MESSAGE}"
|
||||||
cp -v ${PIHOLE_DIR}/${GRAVITY_FI} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.backup
|
cp -v ${PIHOLE_DIR}/${GRAVITY_FI} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.backup
|
||||||
echo -e "[${CYAN}STAT${NC}] Replacing ${GRAVITY_FI} on $HOSTNAME"
|
error_validate
|
||||||
|
|
||||||
|
MESSAGE="Replacing ${GRAVITY_FI} on $HOSTNAME"
|
||||||
|
echo -e "${STAT} ${MESSAGE}"
|
||||||
sudo cp -v $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.pull ${PIHOLE_DIR}/${GRAVITY_FI}
|
sudo cp -v $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.pull ${PIHOLE_DIR}/${GRAVITY_FI}
|
||||||
|
error_validate
|
||||||
|
|
||||||
|
MESSAGE="Setting Permissions on ${GRAVITY_FI}"
|
||||||
|
echo -e "${STAT} ${MESSAGE}"
|
||||||
sudo chmod 644 ${PIHOLE_DIR}/${GRAVITY_FI}
|
sudo chmod 644 ${PIHOLE_DIR}/${GRAVITY_FI}
|
||||||
|
error_validate
|
||||||
|
|
||||||
|
MESSAGE="Setting Ownership on ${GRAVITY_FI}"
|
||||||
|
echo -e "${STAT} ${MESSAGE}"
|
||||||
sudo chown pihole:pihole ${PIHOLE_DIR}/${GRAVITY_FI}
|
sudo chown pihole:pihole ${PIHOLE_DIR}/${GRAVITY_FI}
|
||||||
echo -e "${GRAVITY_FI} ownership and file permissions reset"
|
error_validate
|
||||||
echo -e "[${CYAN}STAT${NC}] Reloading FTLDNS Configuration"
|
|
||||||
|
MESSAGE="Reloading FTLDNS Configuration"
|
||||||
|
echo -e "${STAT} ${MESSAGE}"
|
||||||
pihole restartdns reloadlists
|
pihole restartdns reloadlists
|
||||||
pihole restartdns
|
pihole restartdns
|
||||||
logs_export
|
error_validate
|
||||||
|
|
||||||
|
logs_export
|
||||||
exit_withchange
|
exit_withchange
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,8 +226,8 @@ function exit_withchange {
|
|||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Error Validation
|
||||||
function if_validate {
|
function error_validate {
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
echo -e "${FAIL} ${MESSAGE}"
|
echo -e "${FAIL} ${MESSAGE}"
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user