From 68a58e94cba212764d00a7a8c879c48c28090c76 Mon Sep 17 00:00:00 2001 From: New Future Date: Mon, 7 Nov 2016 15:29:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0windows=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 13 ++++++++++++- task.bat | 9 ++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7ab77af..ce2e496 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ python run.py -c /path/to/config.json * `public`使用公网ip(使用公网API查询) * `nku` NKU网关ip(只支持ipv4) -## example +### 配置example ```json { @@ -53,3 +53,14 @@ python run.py -c /path/to/config.json "debug": true } ``` + +## 定时任务 +默认没5分钟检查一次ip变化,自动更新 + +### windows +**需要已经安装python** +* 以当前用户身份运行定时任务,双击或者运行`task.bat` (执行时会闪黑框) +* 以系统身份运行定时任务,双击或者运行`task.bat` (右键管理员身份运行) + +### linux +运行 `sudo ./task.sh` \ No newline at end of file diff --git a/task.bat b/task.bat index ad9fc24..2482ee3 100644 --- a/task.bat +++ b/task.bat @@ -6,5 +6,12 @@ REM [/RU username [/RP [password]] /SC schedule [/MO modifier] [/D day] REM [/M months] [/I idletime] /TN taskname /TR taskrun [/ST starttime] REM [/RI interval] [ {/ET endtime | /DU duration} [/K] REM [/XML xmlfile] [/V1]] [/SD startdate] [/ED enddate] [/IT] [/Z] [/F] -schtasks /Create /SC MINUTE /MO 5 /TR "%~dp0run.bat" /TN DDNS + +IF %ERRORLEVEL% EQU 0 ( + echo run task as SYSTEM + schtasks /Create /SC MINUTE /MO 5 /TR "%~dp0run.bat" /TN "DDNS" /F /RU "SYSTEM" +) ELSE ( + echo run task as USER + schtasks /Create /SC MINUTE /MO 5 /TR "%~dp0run.bat" /TN "DDNS" /F +) PAUSE