代码拉取完成,页面将自动刷新
import datetime
import os
import signal
import time
from settings import *
from crontab import CronTab
time_format = "%Y-%m-%d %H:%M:%S"
def stop_me(_signo, _stack):
log.info("Docker container has stoped....")
exit(-1)
def main():
signal.signal(signal.SIGINT, stop_me)
log.info("使用DOCKER运行原神签到")
env = os.environ
cron_signin = env["CRON_SIGNIN"]
cron = CronTab(cron_signin, loop=True, random_seconds=True)
def next_run_time():
nt = datetime.datetime.now().strftime(time_format)
delayt = cron.next(default_utc=False)
nextrun = datetime.datetime.now() + datetime.timedelta(seconds=delayt)
nextruntime = nextrun.strftime(time_format)
log.info(f"Current running datetime: {nt}")
log.info(f"Next run datetime: {nextruntime}")
def sign():
log.info("Starting signing")
os.system("python3 ./genshin.py")
sign()
next_run_time()
while True:
ct = cron.next(default_utc=False)
time.sleep(ct)
sign()
next_run_time()
if __name__ == '__main__':
main()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。