Skip to content

【一些看法】windows使用WSL运行脚本且输出日志 #4

@franocisgar

Description

@franocisgar

修改FNplus中的中文字符为英文(由于bat变量有中文和空格时会有奇奇怪怪的问题,所以直接全部翻译FNplus.py中的中文),且另存为FNplusEN.py

Freenom 续期消息版 → FreedomRenewalMessage
加载通知服务失败 → FailedToLoadNotificationService
Freenom 续期 → FreenomRenewal
{domain} 续期成功 → {domain}RenewalSucceeded
{domain} 续期失败 → {domain}RenewalFailed
{domain} 还有 {days} 天续期 → {domain}Have{days}DaysToRenew
你没有添加任何账户 → YouHaven'tAddedAnyAccounts
账户与密码不匹配 → AccountAndPasswordDoNotMatch

添加bat进行定时任务
bat内容如下。

@echo off
mode con cols=60 lines=20
title FreenomGetFree
:loop
echo [%date:~,-3% %time:~,-3%]Start detection.
echo [%date:~,-3% %time:~,-3%]Start detection. >> Log.log
for /F %%i in ('wsl python3 FNplusEN.py -u USERNAME -p PASSWORD') do ( set commitid=%%i)
echo %commitid%
echo %commitid% >> Log.log
for /F %%i in ('wsl python3 FNplusEN.py -u USERNAME -p PASSWORD') do ( set commitid=%%i)
echo %commitid%
echo %commitid% >> Log.log
echo [%date:~,-3% %time:~,-3%]After the detection is completed, wait for a day to start the next round of detection.
echo [%date:~,-3% %time:~,-3%]After the detection is completed, wait for a day to start the next round of detection. >> Log.log
timeout /t 86400 >nul
goto loop

bat创建快捷方式,添加开机自启即可。
我目前是使用这种方法的,不知道作者及各位有什么高见?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions