From d3ac8bb6f8899d13e6725c3a780ee810179426c7 Mon Sep 17 00:00:00 2001 From: jeremysherriff Date: Fri, 19 Oct 2018 18:21:11 +1300 Subject: [PATCH 1/2] Silence updateGravity job unless errors occur No need for append/logrotate as we are only interested in the latest output Signed-off-by: jeremysherriff --- advanced/Templates/pihole.cron | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/advanced/Templates/pihole.cron b/advanced/Templates/pihole.cron index 02a63b74..8dc98721 100644 --- a/advanced/Templates/pihole.cron +++ b/advanced/Templates/pihole.cron @@ -16,7 +16,9 @@ # Pi-hole: Update the ad sources once a week on Sunday at a random time in the # early morning. Download any updates from the adlists -59 1 * * 7 root PATH="$PATH:/usr/local/bin/" pihole updateGravity +# Squash output to log, then splat the log to stdout on error to allow for +# standard crontab job error handling. +59 1 * * 7 root PATH="$PATH:/usr/local/bin/" pihole updateGravity >/var/log/pihole_updateGravity.log || cat /var/log/pihole_updateGravity.log # Pi-hole: Flush the log daily at 00:00 # The flush script will use logrotate if available From d986da63a5742dc2a5e4eab490740e58a098ee22 Mon Sep 17 00:00:00 2001 From: jeremysherriff Date: Fri, 19 Oct 2018 18:27:35 +1300 Subject: [PATCH 2/2] Pass gravity exit code back to caller to allow for cron error handling Signed-off-by: jeremysherriff --- pihole | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pihole b/pihole index 0d6a45ce..fb398f29 100755 --- a/pihole +++ b/pihole @@ -80,7 +80,7 @@ reconfigurePiholeFunc() { updateGravityFunc() { "${PI_HOLE_SCRIPT_DIR}"/gravity.sh "$@" - exit 0 + exit $? } queryFunc() {