From: Scott Gasch Date: Tue, 22 Nov 2022 20:07:34 +0000 (-0800) Subject: Do not touch timestamp if cronjob failed! X-Git-Url: https://wannabe.guru.org/gitweb/?a=commitdiff_plain;h=6cc5bbeafe0451254bfc5cd3460061b1d3693c2d;p=pyutils.git Do not touch timestamp if cronjob failed! --- diff --git a/examples/cron/cron.py b/examples/cron/cron.py index 4b7d5eb..6e0667d 100755 --- a/examples/cron/cron.py +++ b/examples/cron/cron.py @@ -90,7 +90,7 @@ def run_command(timeout: Optional[int], timestamp_file: Optional[str]) -> int: logger.debug( f"____ (↑↑↑ subprocess finished in {t():.2f}s, exit value was {ret} ↑↑↑) ____" ) - if timestamp_file is not None and os.path.exists(timestamp_file): + if ret == 0 and timestamp_file is not None and os.path.exists(timestamp_file): logger.debug("Touching %s", timestamp_file) file_utils.touch_file(timestamp_file) return ret