From 562788e9ff94880697399ec9008c16f2c774d581 Mon Sep 17 00:00:00 2001 From: Jepp9350 <2jepp9350@gmail.com> Date: Wed, 29 Jan 2025 17:20:39 +0100 Subject: [PATCH] `Update backup service to use periodic execution with curl` The Dockerfile now uses a loop to run the backup script every 60 seconds. Added `curl` installation and a curl command in `backup.sh` for external script execution. Removed unused echo statements for clarity. --- services/backup/Dockerfile | 6 +++--- services/backup/backup.sh | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/services/backup/Dockerfile b/services/backup/Dockerfile index fa4dfb3f..a15f527e 100644 --- a/services/backup/Dockerfile +++ b/services/backup/Dockerfile @@ -1,9 +1,9 @@ FROM ubuntu:latest LABEL authors="Jeppe B" -RUN apt-get update && apt-get install -y cron +RUN apt-get update && apt-get install -y cron curl COPY backup.sh /backup.sh RUN chmod +x /backup.sh # Set the timezone RUN ln -fs /usr/share/zoneinfo/Europe/Copenhagen /etc/localtime -# Send a message, and run the backup script -CMD echo "Backup service is running" && /backup.sh \ No newline at end of file +# Loop sleep, run backup.sh every 60 seconds +CMD while true; do /backup.sh; sleep 60; done \ No newline at end of file diff --git a/services/backup/backup.sh b/services/backup/backup.sh index 11ba90e4..9210f6ef 100644 --- a/services/backup/backup.sh +++ b/services/backup/backup.sh @@ -1,3 +1,7 @@ # Show the script is running -echo "Backup script started at $(date)" -# TODO: Implement the script here \ No newline at end of file +#echo "Backup script started at $(date)" +#echo "Auth key: $auth_key" +# Curl the backup script +curl -s "https://nnks.truckwash.dk/?internalCronCall=true&script=run&action=cron&auth_key=$auth_key" +# Show the script has finished +#echo "Backup script finished at $(date)" \ No newline at end of file