Skip to content

Commit

Permalink
Merge pull request #22 from skysea04/dev
Browse files Browse the repository at this point in the history
FIX: Fix cronjob issue
  • Loading branch information
skysea04 authored Aug 15, 2024
2 parents 2dc9ece + 764d1c3 commit 9936819
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ RUN mkdir -p logs/ && \
pip install -r /requirements/live.txt && \
chmod -R 755 /src/jobs/ && \
echo "30 */8 * * * /src/jobs/health_check.sh" >> /var/spool/cron/crontabs/root && \
echo "0 18 * * * /src/jobs/remind_snap_up.sh" >> /var/spool/cron/crontabs/root
echo "0 18 * * * /src/jobs/remind_snap_up.sh" >> /var/spool/cron/crontabs/root && \
printenv > /etc/environment

CMD nohup python manage.py continue_snap_up & cron && gunicorn --bind=0.0.0.0:8000 --timeout=300 --keep-alive=60 src.wsgi:application
2 changes: 1 addition & 1 deletion docker-compose.yml sample
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ services:
- ./requirements:/requirements
# ports:
# - "8686:8000"
command: bash -c "pip freeze > /requirements/live.txt && tail -f /dev/null"
command: bash -c "printenv > /etc/environment && pip freeze > /requirements/live.txt && tail -f /dev/null"
environment:
DEPLOY: dev
DJANGO_SECRET_KEY: dev
Expand Down
10 changes: 5 additions & 5 deletions requirements/live.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ coloredlogs==15.0.1
ddddocr==1.5.5
Django==4.2
flatbuffers==24.3.25
gunicorn==22.0.0
gunicorn==23.0.0
humanfriendly==10.0
idna==3.7
mpmath==1.3.0
numpy==1.26.4
onnxruntime==1.18.1
opencv-python-headless==4.10.0.84
packaging==24.1
phonenumbers==8.13.40
phonenumbers==8.13.43
pillow==10.4.0
protobuf==5.27.2
protobuf==5.27.3
psycopg==3.2.1
pydantic==2.8.2
pydantic_core==2.20.1
pytz==2024.1
redis==5.0.8
requests==2.32.3
soupsieve==2.5
soupsieve==2.6
sqlparse==0.5.1
sympy==1.13.1
sympy==1.13.2
typing_extensions==4.12.2
urllib3==2.2.2
6 changes: 5 additions & 1 deletion src/jobs/health_check.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
#!/bin/bash
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

source /etc/environment >> /src/logs/cron.log 2>&1
cd /src
python manage.py snap_up_health_check
python manage.py snap_up_health_check >> /src/logs/cron.log 2>&1
6 changes: 5 additions & 1 deletion src/jobs/remind_snap_up.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
#!/bin/bash
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

source /etc/environment >> /src/logs/cron.log 2>&1
cd /src
python manage.py remind_snap_up
python manage.py remind_snap_up >> /src/logs/cron.log 2>&1

0 comments on commit 9936819

Please sign in to comment.