[~] Refactor
This commit is contained in:
parent
6df412cf1e
commit
1b01d9b324
@ -1,3 +1,4 @@
|
|||||||
|
import signal
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
@ -89,6 +90,20 @@ def service():
|
|||||||
need_wait = False
|
need_wait = False
|
||||||
last_disabled = False
|
last_disabled = False
|
||||||
|
|
||||||
|
def handle_exit(*argv):
|
||||||
|
sys.stderr.write('got %s\n' % pprint.pformat(argv))
|
||||||
|
sys.stderr.flush()
|
||||||
|
raise KeyboardInterrupt
|
||||||
|
|
||||||
|
for current_signal in [
|
||||||
|
signal.SIGINT,
|
||||||
|
signal.SIGTERM
|
||||||
|
]:
|
||||||
|
signal.signal(
|
||||||
|
current_signal,
|
||||||
|
handle_exit,
|
||||||
|
)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
if need_wait:
|
if need_wait:
|
||||||
|
@ -3,4 +3,5 @@ WORKDIR /app
|
|||||||
|
|
||||||
RUN pip3 install requests
|
RUN pip3 install requests
|
||||||
|
|
||||||
ENTRYPOINT exec python3 d1/dynu_update tmp/cache/dynu.auth.json ngrok
|
CMD ["-c", "exec python3 d1/dynu_update.py tmp/cache/dynu.auth.json ngrok"]
|
||||||
|
ENTRYPOINT ["/bin/bash"]
|
||||||
|
Loading…
Reference in New Issue
Block a user