chore:cron

This commit is contained in:
guorong.zheng 2024-08-16 15:47:12 +08:00
parent dd5cfcd61f
commit d291288f1f
3 changed files with 9 additions and 8 deletions

@ -44,7 +44,11 @@ RUN if [ "$INSTALL_CHROMIUM" = "true" ]; then \
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
RUN (crontab -l ; echo "0 22 * * * cd $APP_WORKDIR && /usr/local/bin/pipenv run python main.py scheduled_task 2>&1 | tee -a /var/log/tv.log"; echo "0 10 * * * cd $APP_WORKDIR && /usr/local/bin/pipenv run python main.py scheduled_task 2>&1 | tee -a /var/log/tv.log") | crontab -
RUN (crontab -l ; \
echo "0 22 * * * cd $APP_WORKDIR && /usr/local/bin/pipenv run python main.py scheduled_task"; \
echo "0 10 * * * cd $APP_WORKDIR && /usr/local/bin/pipenv run python main.py scheduled_task") | crontab -
CMD ["cron", "-f"]
EXPOSE 8000

@ -8,8 +8,4 @@ for file in /tv_config/*; do
fi
done
PYTHONUNBUFFERED=1 pipenv run python $APP_WORKDIR/main.py scheduled_task 2>&1 | tee -a /var/log/tv.log
cron
tail -f /var/log/tv.log
pipenv run python $APP_WORKDIR/main.py

@ -118,7 +118,7 @@ class UpdateSource:
int((self.pbar.n / len(self.tasks)) * 100),
)
self.start_time = time()
sort_results = await tqdm_asyncio.gather(*self.tasks, disable=True)
sort_results = await tqdm_asyncio.gather(*self.tasks, desc="Sorting")
self.channel_data = {}
for result in sort_results:
if result:
@ -201,6 +201,7 @@ def scheduled_task():
if __name__ == "__main__":
scheduled_task()
if len(sys.argv) == 1 or (len(sys.argv) > 1 and sys.argv[1] == "scheduled_task"):
scheduled_task()
if not os.environ.get("GITHUB_ACTIONS"):
app.run(host="0.0.0.0", port=8000)