feat: 实现定时任务半小时内随机执行 #206 (#295)

This commit is contained in:
zhuweitung 2024-11-14 19:58:58 +08:00 committed by GitHub
parent 971b867321
commit 9aa06e0e7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,7 +11,7 @@ COPY ./utils ./utils
COPY ./pyproject.toml ./pdm.lock ./miuitask.py ./docker_start.sh ./
RUN pdm install --prod && \
echo "0 4 * * * cd /srv && pdm run /srv/miuitask.py" > /var/spool/cron/crontabs/root && \
echo '0 4 * * * /bin/sh -c "sleep $((RANDOM % 1800 + 1)); cd /srv && pdm run /srv/miuitask.py"' > /var/spool/cron/crontabs/root && \
chmod +x docker_start.sh
VOLUME ["/srv/data", "/srv/logs"]