Skip to content

Commit

Permalink
change to build in crond
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrtye committed Mar 5, 2024
1 parent 255ce75 commit a5932fa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
10 changes: 3 additions & 7 deletions submanager/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@ ENV TZ=Europe/London
COPY . /submanager
RUN pip install --no-cache-dir -r /submanager/requirements.txt

RUN mkdir -p /sub /conf.d /submanager \
&& apk --no-cache add dcron at \
&& echo -e "python -u /submanager/update_nginx_config.py 2>&1" | at now + 1 minute \
&& echo -e "python -u /submanager/remove_subscription.py 2>&1" | at now + 1 minute \
&& echo -e "python -u /submanager/update_subscription.py 2>&1" | at now + 1 minute \
&& echo -e "0 6,18 * * * python -u /submanager/update_subscription.py 2>&1\n" > /etc/crontabs/root
RUN chmod 755 /submanager/entry.sh
RUN /usr/bin/crontab /submanager/crontab.txt

VOLUME /sub
VOLUME /conf.d

ENTRYPOINT /usr/sbin/crond -f
CMD ["/submanager/entry.sh"]
1 change: 1 addition & 0 deletions submanager/crontab.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* * * * * python -u /submanager/update_subscription.py
7 changes: 7 additions & 0 deletions submanager/entry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

# start cron
python -u /submanager/update_nginx_config.py
python -u /submanager/remove_subscription.py
python -u /submanager/update_subscription.py
/usr/sbin/crond -f -l 8

0 comments on commit a5932fa

Please sign in to comment.