From fdad6c3d7261badc8c27d2a49d3c10308e36a28d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Ole=20Hu=CC=88bner?= Date: Sun, 18 Aug 2024 00:06:38 +0200 Subject: [PATCH] x vcbxfdfsfgrfWFEFF --- Dockerfile | 2 +- delay_price.sh | 6 ------ start.sh | 11 +++++++++++ 3 files changed, 12 insertions(+), 7 deletions(-) delete mode 100644 delay_price.sh diff --git a/Dockerfile b/Dockerfile index dd424f4..297617e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,6 +20,6 @@ RUN crontab /etc/cron.d/get_price RUN touch /var/log/cron.log -RUN chmod 755 /app/pulse.py /app/get_price.py /app/start.sh /app/delay_price.sh +RUN chmod 755 /app/pulse.py /app/get_price.py /app/start.sh CMD ["/app/start.sh"] diff --git a/delay_price.sh b/delay_price.sh deleted file mode 100644 index 2515c71..0000000 --- a/delay_price.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -source /app/env -printenv -sleep 2 - -python3 /app/get_price.py >> /var/log/cron.log 2>&1 \ No newline at end of file diff --git a/start.sh b/start.sh index 6632127..9df20c4 100644 --- a/start.sh +++ b/start.sh @@ -1,11 +1,22 @@ #!/bin/bash + +# Print environment variables to a file printenv > /app/env + # Start the cron service service cron start # Run your main application script (pulse.py) in the background python3 /app/pulse.py & +# Run the other script periodically in the background +( + while true; do + python3 /app/get_price.py >> /var/log/other_script.log 2>&1 + sleep 3 # Sleep for 60 seconds (1 minute) + done +) & + # Keep the container running and output both cron logs and pulse.py output tail -f /var/log/cron.log & wait -n