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 ##################### # GRAVITY SYNC BY VMSTAN #####################
PROGRAM='Gravity Sync' 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) # 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 # 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 sudo chown pihole:pihole ${PIHOLE_DIR}/${GRAVITY_FI} >/dev/null 2>&1
error_validate error_validate
sleep 3 MESSAGE="Pausing One Second"
echo -e "${INFO} ${MESSAGE}"
sleep 1
MESSAGE="Updating FTLDNS Configuration" MESSAGE="Updating FTLDNS Configuration"
echo -en "${STAT} ${MESSAGE}" echo -en "${STAT} ${MESSAGE}"
pihole restartdns reloadlists >/dev/null 2>&1 /usr/local/bin/pihole restartdns reloadlists >/dev/null 2>&1
error_validate error_validate
MESSAGE="Reloading FTLDNS Services" MESSAGE="Reloading FTLDNS Services"
echo -en "${STAT} ${MESSAGE}" echo -en "${STAT} ${MESSAGE}"
pihole restartdns >/dev/null 2>&1 /usr/local/bin/pihole restartdns >/dev/null 2>&1
error_validate error_validate
logs_export 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 ${SSHPASSWORD} ssh ${REMOTE_USER}@${REMOTE_HOST} "sudo chown pihole:pihole ${PIHOLE_DIR}/${GRAVITY_FI}" >/dev/null 2>&1
error_validate error_validate
sleep 3 MESSAGE="Pausing One Second"
echo -e "${INFO} ${MESSAGE}"
sleep 1
MESSAGE="Updating FTLDNS Configuration" MESSAGE="Updating FTLDNS Configuration"
echo -en "${STAT} ${MESSAGE}" echo -en "${STAT} ${MESSAGE}"
@ -220,22 +224,22 @@ function show_crontab {
CRONPATH="$HOME/${LOCAL_FOLDR}/${CRONJOB_LOG}" CRONPATH="$HOME/${LOCAL_FOLDR}/${CRONJOB_LOG}"
MESSAGE="Replaying Last Cronjob" MESSAGE="Replaying Last Cronjob"
echo -e "${STAT} ${MESSAGE}" echo -en "${STAT} ${MESSAGE}"
if [ -f ${CRONPATH} ] if [ -f ${CRONPATH} ]
then then
if [ -s ${CRONPATH} ] if [ -s ${CRONPATH} ]
echo -e "${GOOD} ${MESSAGE}" echo -e "\r${GOOD} ${MESSAGE}"
logs_crontab logs_crontab
exit_nochange exit_nochange
then then
echo -e "${FAIL} ${MESSAGE}" echo -e "\r${FAIL} ${MESSAGE}"
echo -e "${INFO} ${CRONPATH} appears empty" echo -e "${INFO} ${CRONPATH} appears empty"
exit_nochange exit_nochange
fi fi
else else
echo -e "${FAIL} ${MESSAGE}" echo -e "\r${FAIL} ${MESSAGE}"
echo -e "${YELLOW}${CRONPATH}${NC} cannot be located" echo -e "${INFO} ${CRONPATH} cannot be located"
exit_nochange exit_nochange
fi fi
} }