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.
This commit is contained in:
Jepp9350
2025-01-29 17:20:39 +01:00
parent d5e3991bf8
commit 562788e9ff
2 changed files with 9 additions and 5 deletions
+3 -3
View File
@@ -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
# Loop sleep, run backup.sh every 60 seconds
CMD while true; do /backup.sh; sleep 60; done
+6 -2
View File
@@ -1,3 +1,7 @@
# Show the script is running
echo "Backup script started at $(date)"
# TODO: Implement the script here
#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)"