1
0

feat:run twice daily

This commit is contained in:
guorong.zheng 2024-07-18 17:46:53 +08:00
parent 9718d58b45
commit bc5599ec30
3 changed files with 8 additions and 5 deletions

@ -3,6 +3,7 @@ name: 'update schedule'
on:
schedule:
- cron: '0 22 * * *'
- cron: '0 10 * * *'
workflow_dispatch:
branches:
- master

@ -12,8 +12,8 @@ RUN pip install -i https://mirrors.aliyun.com/pypi/simple pipenv
RUN pipenv install
RUN sed -i 's@deb.debian.org@mirrors.aliyun.com@g' /etc/apt/sources.list \
&& sed -i 's@security.debian.org@mirrors.aliyun.com@g' /etc/apt/sources.list
RUN sed -i "s@deb.debian.org@mirrors.aliyun.com@g" /etc/apt/sources.list \
&& sed -i "s@security.debian.org@mirrors.aliyun.com@g" /etc/apt/sources.list
RUN apt-get update && apt-get install -y cron
@ -21,7 +21,7 @@ ARG INSTALL_CHROMIUM=false
RUN if [ "$INSTALL_CHROMIUM" = "true" ]; then apt-get install -y chromium chromium-driver cron; fi
RUN (crontab -l 2>/dev/null; echo "0 7 * * * pipenv run python $APP_WORKDIR/main.py scheduled_task"; echo "0 8 * * * pipenv run python $APP_WORKDIR/main.py scheduled_task") | crontab -
RUN (crontab -l ; echo "0 22 * * * pipenv run python $APP_WORKDIR/main.py scheduled_task 2>&1 | tee -a /var/log/tv.log"; echo "0 10 * * * pipenv run python $APP_WORKDIR/main.py scheduled_task 2>&1 | tee -a /var/log/tv.log") | crontab -
EXPOSE 8000

@ -1,5 +1,7 @@
#!/bin/bash
pipenv run python $APP_WORKDIR/main.py scheduled_task
pipenv run python $APP_WORKDIR/main.py scheduled_task 2>&1 | tee -a /var/log/tv.log
service cron start
cron
tail -f /var/log/tv.log