fix cron service restart

This commit is contained in:
Michael Stanclift 2020-05-25 23:58:26 -05:00
parent d787d7e457
commit 65dd7a42c2

View File

@ -2,7 +2,7 @@
# GRAVITY SYNC BY VMSTAN #####################
PROGRAM='Gravity Sync'
VERSION='1.3.1'
VERSION='1.3.3'
# Must execute from a location in the home folder of the user who own's it (ex: /home/pi/gravity-sync)
# Configure certificate based SSH authentication between the Pi-hole HA nodes - it does not use passwords
@ -130,16 +130,18 @@ function pull_gs {
sudo chown pihole:pihole ${PIHOLE_DIR}/${GRAVITY_FI} >/dev/null 2>&1
error_validate
sleep 3
MESSAGE="Pausing One Second"
echo -e "${INFO} ${MESSAGE}"
sleep 1
MESSAGE="Updating FTLDNS Configuration"
echo -en "${STAT} ${MESSAGE}"
pihole restartdns reloadlists >/dev/null 2>&1
/usr/local/bin/pihole restartdns reloadlists >/dev/null 2>&1
error_validate
MESSAGE="Reloading FTLDNS Services"
echo -en "${STAT} ${MESSAGE}"
pihole restartdns >/dev/null 2>&1
/usr/local/bin/pihole restartdns >/dev/null 2>&1
error_validate
logs_export
@ -178,7 +180,9 @@ function push_gs {
${SSHPASSWORD} ssh ${REMOTE_USER}@${REMOTE_HOST} "sudo chown pihole:pihole ${PIHOLE_DIR}/${GRAVITY_FI}" >/dev/null 2>&1
error_validate
sleep 3
MESSAGE="Pausing One Second"
echo -e "${INFO} ${MESSAGE}"
sleep 1
MESSAGE="Updating FTLDNS Configuration"
echo -en "${STAT} ${MESSAGE}"
@ -220,22 +224,22 @@ function show_crontab {
CRONPATH="$HOME/${LOCAL_FOLDR}/${CRONJOB_LOG}"
MESSAGE="Replaying Last Cronjob"
echo -e "${STAT} ${MESSAGE}"
echo -en "${STAT} ${MESSAGE}"
if [ -f ${CRONPATH} ]
then
if [ -s ${CRONPATH} ]
echo -e "${GOOD} ${MESSAGE}"
echo -e "\r${GOOD} ${MESSAGE}"
logs_crontab
exit_nochange
then
echo -e "${FAIL} ${MESSAGE}"
echo -e "\r${FAIL} ${MESSAGE}"
echo -e "${INFO} ${CRONPATH} appears empty"
exit_nochange
fi
else
echo -e "${FAIL} ${MESSAGE}"
echo -e "${YELLOW}${CRONPATH}${NC} cannot be located"
echo -e "\r${FAIL} ${MESSAGE}"
echo -e "${INFO} ${CRONPATH} cannot be located"
exit_nochange
fi
}