defrun_cmd(server): status = subprocess.call(CMD.format(server)) if status == 0: returnTrue
ip = IP_MAPS.get(server) if ip: return subprocess.call(CMD.format(ip), shell=True) == 0
returnFalse
@click.command() @click.option('--servers', default=DEFAULT_SERVERS, help='servers name or IP list, seperated by ","') @click.option('--sleep', default=600, help='sleep seconds till next run, default is 600s (10 minutes)') defsync_time(servers, sleep): while1: for server in servers.split(','): if run_cmd(server.strip()): break
@echo off set service=SyncTimer echo %PROCESSOR_ARCHITECTURE% | find /i "x86" > nul if %errorlevel%==0 ( set nssm=nssm32.exe ) else ( set nssm=nssm64.exe )
%nssm% install "%service%" "%~dp0SyncTimer.exe"
net start %service%
sleep 5
3.2 remove.bat
remove.bat
1 2 3 4 5 6 7 8 9 10 11 12 13
@echo off set exename=SyncTimer net stop %exename%
echo %PROCESSOR_ARCHITECTURE% | find /i "x86" > nul if %errorlevel%==0 ( set nssm=nssm32.exe ) else ( set nssm=nssm64.exe )