From e8ac879403e82f7340adffcea1b66c741a76f887 Mon Sep 17 00:00:00 2001 From: jblu Date: Tue, 28 May 2024 15:43:54 -0500 Subject: [PATCH] Updated healthchecks to have a run time --- HealthchecksIO.py | 4 +++- seafile-backup.py | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/HealthchecksIO.py b/HealthchecksIO.py index 599db3a..138931b 100644 --- a/HealthchecksIO.py +++ b/HealthchecksIO.py @@ -1,4 +1,6 @@ -def healthcheck_ping(req_obj, url): +def healthcheck_ping(req_obj, url, start=False): + if start == True: + url + '/start' try: req_obj.get(url, timeout=10) except req_obj.RequestException as e: diff --git a/seafile-backup.py b/seafile-backup.py index 0a5128e..3a04a1c 100644 --- a/seafile-backup.py +++ b/seafile-backup.py @@ -77,6 +77,10 @@ apprise_aurls = os.getenv("apprise_aurls") apprise_title = os.getenv("apprise_title") apprise_body = os.getenv("apprise_body") +# healthcheck - Tell healthchecks.io we are starting the backup +if healthcheck: + healthcheck_ping(r, healthcheck_url, start=True) + # Stop seafile and seafile hub if docker_command: os.system(f'docker exec {container_name} /opt/seafile/seafile-serverlatest/seahub.sh stop')