x vcbxfdfsfgrfWFEFF
This commit is contained in:
parent
c889c9f6de
commit
fdad6c3d72
3 changed files with 12 additions and 7 deletions
|
@ -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"]
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
#!/bin/bash
|
||||
source /app/env
|
||||
printenv
|
||||
sleep 2
|
||||
|
||||
python3 /app/get_price.py >> /var/log/cron.log 2>&1
|
11
start.sh
11
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue