import win32serviceutil
import win32service
import win32event
import os
import logging
import inspect
import time
from update_client import *
import socket
import json
import websocket
import requests
import traceback
import threading
import configparser
#AzUpdateService.py
class UpdateService(win32serviceutil.ServiceFramework):
_svc_name_ = "AzUpdateService"
_svc_display_name_ = "Anzer Update Service"
_svc_description_ = "This is a python service code "
def __init__(self, args):
win32serviceutil.ServiceFramework.__init__(self, args)
self.hWaitStop = win32event.CreateEvent(None, 0, 0, None)
self.logger = self._getLogger()
self.run = True
self.recv_port = 5650
self.send_port = 5651
# self.target_ip = '127.0.0.1' # 机器人ip
# self.local_ip = '127.0.0.1' # 本机ip
# self.s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# self.s.bind((self.local_ip, self.recv_port))
self.count = 0
self.time_running = True
self.cf = configparser.ConfigParser()
cnf = os.path.join(os.path.dirname(__file__), 'company.ini')
self.cf.read(cnf)
"""
[company]
id=1
server_ip=116.6.229.133
server_port=8866
"""
def _getLogger(self):
# logger = logging.getLogger('[UpdateService]')
# this_file = inspect.getfile(inspect.currentframe())
# dirpath = os.path.abspath(os.path.dirname(this_file))
# handler = logging.FileHandler(os.path.join(dirpath, "update_service.log"))
# formatter = logging.Formatter('%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
# handler.setFormatter(formatter)
# logger.addHandler(handler)
# logger.setLevel(logging.INFO)
this_file = inspect.getfile(inspect.currentframe())
dirpath = os.path.abspath(os.path.dirname(this_file))
log_dir = os.path.join(dirpath, 'log')
if not os.path.exists(log_dir):
os.mkdir(log_dir)
name = os.path.join(dirpath, log_dir, "update")
import logging
import logging.handlers
# logging初始化工作
logging.basicConfig()
# myapp的初始化工作
logger = logging.getLogger('[UpdateService]')
logger.setLevel(logging.INFO)
# 添加TimedRotatingFileHandler
# 定义一个1秒换一次log文件的handler
# 保留3个旧log文件
filehandler = logging.handlers.TimedRotatingFileHandler(
name, when='H', interval=6, backupCount=10)
# 设置后缀名称,跟strftime的格式一样
filehandler.suffix = "%Y-%m-%d_%H-%M-%S.log"
formatter = logging.Formatter(
'%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
filehandler.setFormatter(formatter)
logger.addHandler(filehandler)
return logger
def SvcDoRun1(self):
self.logger.info("service is run....")
addr = (self.target_ip, self.send_port)
# main_run(self.logger)
while self.run:
try:
if self.s != None:
self.logger.info("listening....")
data = self.s.recv(1024).decode('utf-8')
self.logger.info(data)
if len(data) > 10:
uuid = run_main(data, self.logger,
client=self.s, addr=addr)
self.logger.info('uuid: '+uuid)
if len(uuid) > 0:
time.sleep(3)
self.s = socket.socket(
socket.AF_INET, socket.SOCK_DGRAM)
self.s.bind((self.local_ip, self.recv_port))
self.logger.info('try reconnect and send')
js = json.dumps({"cmd": 642, "sn": 3, "uuid": uuid, "body": {
'error': 0, 'result': 1, 'msg': '{} Update Finish, Superdog is running'.format(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))}})
jsbs = bytes(js, encoding='utf-8')
self.s.sendto(jsbs, addr)
else:
time.sleep(3)
self.s = socket.socket(
socket.AF_INET, socket.SOCK_DGRAM)
self.s.bind((self.local_ip, self.recv_port))
self.logger.info('try reconnect')
except Exception as e:
self.logger.error('error '+e)
if len(e.args) > 0 and str(e.args[1]).startswith('远程主机强迫关闭了一个现有的连接'):
try:
# self.run=0
# os._exit(0)
time.sleep(5)
self.s = socket.socket(
socket.AF_INET, socket.SOCK_DGRAM)
self.s.bind((self.local_ip, self.recv_port))
# print('reconnect')
self.logger.info('reconnect')
except Exception as e:
self.logger.error(e)
elif len(e.args) > 0 and str(e.args[1]).startswith('你的主机中的软件中止了一个已建立的连接'):
try:
# self.run=0
# os._exit(0)
time.sleep(5)
self.s = socket.socket(
socket.AF_INET, socket.SOCK_DGRAM)
self.s.bind((self.local_ip, self.recv_port))
self.logger.info('reconnect')
except Exception as e:
self.logger.error(e)
self.logger.info('SvcDoRun stop service')
self.s.close()
def SvcDoRun(self):
logger = self.logger
logger.info('start')
old_company = self.cf.get('company', 'id')
server_ip = self.cf.get('company', 'server_ip')
server_port = self.cf.getint('company', 'server_port')
def compare_ver(old_ver, ver):
old_1, old_2, old_3 = old_ver.split('.') # 0.0.2
v1, v2, v3 = ver.split('.') # 0.0.0
if (int(v1) > int(old_1)) or (int(v1) == int(old_1) and int(v2) > int(old_2)) or (int(v1) == int(old_1) and int(v2) == int(old_2) and int(v3) > int(old_3)):
return 1
else:
return 0
def compare_md5(omd5, md5):
if omd5 != md5 and len(md5) > 0 and len(omd5) > 0:
return 1
else:
return 0
def on_message(ws, message):
print(message)
def on_error(ws, error):
print(error)
def on_close(ws):
print("### closed ###")
def on_open(ws):
pass
def run_bat(bat_file,logger):
def run():
try:
logger.info('start run bat')
ret = os.system(bat_file)
logger.info('run bat result :{}'.format(ret))
except:
logger.error(traceback.format_exc())
run()
# t = threading.Thread(target = run)
# t.start()
def init():
plat_bat=''
server_bat=''
try:
ver_file = os.path.join(os.path.dirname(__file__), 'ver.ini')
old_ver = '0.0.0'
old_md5 = ''
if os.path.exists(ver_file):
with open(ver_file, 'r') as f:
txt = f.readline()
data = txt.split('|')
old_plat_ver, old_plat_md5 = data[0].split(':')
old_server_ver, old_server_md5 = data[1].split(':')
url = 'http://{}:{}/read_ver'.format(server_ip, server_port)
resp = requests.get(url)
logger.info('read_ver result :'+resp.text)
js = json.loads(resp.text)
ver = js['plat_ver']['ver']
md5 = js['plat_ver']['md5']
company = js['plat_ver']['company']
# update_type = js['plat_ver']['update_type']
if old_company == company:
md5 = md5.lower()
logger.info('plat info compare , {}=={},{}=={}'.format(
old_plat_md5, md5, old_plat_ver, ver))
cm = compare_md5(old_plat_md5, md5)
cv = compare_ver(old_plat_ver, ver)
logger.info('{},{}'.format(cm, cv))
if cv and cm:
d_url = 'http://{}:{}/download?filename=update.zip'.format(
server_ip, server_port)
logger.info('start run main')
ret,plat_bat = run_main(
d_url, md5, logger=logger, update_type=1)
logger.info('run main resutl {}'.format(ret))
if ret:
content = ''
with open(ver_file, 'r') as f:
txt = f.read()
content = txt.split('|')
with open(ver_file, 'w') as f:
v = '{}:{}'.format(ver, md5)
f.write('{}|{}'.format(v, content[1]))
logger.info('update plat success')
else:
logger.info('update plat failed')
ver = js['server_ver']['ver']
md5 = js['server_ver']['md5']
company = js['server_ver']['company']
# update_type = js['server_ver']['update_type']
if old_company == company:
md5 = md5.lower()
logger.info('{}=={},{}=={}'.format(
old_server_md5, md5, old_server_ver, ver))
cm = compare_md5(old_server_md5, md5)
cv = compare_ver(old_server_ver, ver)
logger.info('server info compare , {},{}'.format(cm, cv))
if cv and cm:
d_url = 'http://{}:{}/download?filename=server_update.zip'.format(
server_ip, server_port)
logger.info('start run main')
ret,server_bat = run_main(
d_url, md5, logger=logger, update_type=2)
logger.info('run main result {}'.format(ret))
if ret:
content = ''
with open(ver_file, 'r') as f:
txt = f.read()
content = txt.split('|')
with open(ver_file, 'w') as f:
v = '{}:{}'.format(ver, md5)
f.write('{}|{}'.format(content[0], v))
logger.info('update server success')
else:
logger.info('update server failed')
except:
logger.info(traceback.format_exc())
self.count = 0
finally:
if len(plat_bat) > 0:
run_bat(plat_bat,logger)
if len(server_bat) > 0:
run_bat(server_bat,logger)
def time_count():
while self.time_running:
self.count = self.count + 1
time.sleep(1)
# websocket.enableTrace(True)
# ws = websocket.WebSocketApp("ws://192.168.18.174:8866",
# on_message=on_message,
# on_error=on_error,
# on_close=on_close,
# on_open=on_open)
# ws.on_open = on_open
# ws.run_forever()
t = threading.Thread(target=time_count)
t.start()
self.logger.info('start ping')
backinfo = os.system('ping {}'.format(server_ip))
times = 0
if backinfo:
self.count = 0
while self.run:
if self.count >= 60 * 1:
self.logger.info('try to update {}'.format(times))
init()
times = times + 1
self.count = 0
if times >= 5:
times = 0
self.time_running = False
self.run = False
break
else:
init()
def SvcStop(self):
self.time_running = False
self.run = False
self.logger.info('SvcStop stop service')
# # stop_run(self.logger)
# try:
# self.s.close()
# except Exception as e:
# pass
# self.logger.info("service is stop....")
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
win32event.SetEvent(self.hWaitStop)
# self.run = False
if __name__ == '__main__':
win32serviceutil.HandleCommandLine(UpdateService)```
import requests
import os
import zipfile
import json
import shutil
import time
import socket
import hashlib
import traceback
import threading
#update_client.py
exelist = [‘AZavstream’, ‘AZfdr’, ‘AZheadface’,
‘AZnav’, ‘AZnet’, ‘AZplatsdk’, ‘AZserial’, ‘AZupdate’]
exelist = []
dog = ‘AzSuperDog’
conf_path = r’C:\AZplat\azconfig\AZsuperdog_config.ini’
bat_file = ‘update.bat’
logger = get_logger(‘az_update_service’,’[UpdateService]’)
def stop_exe(exe):
cmd = r’taskkill /F /IM {}’.format(exe)
os.system(cmd)
print(‘stop {}’.format(exe))
def start_exe(exe):
cmd = r’start {}’.format(exe)
os.system(cmd)
print(‘start {}’.format(exe))
def start_server(name):
cmd = r’net start {}’.format(name)
os.system(cmd)
print(‘start server {}’.format(name))
def stop_server(name):
cmd = r’net stop {}’.format(name)
os.system(cmd)
def unzip_file(zfile_path, unzip_dir, logger=None):
‘’’
function:解压
params:
zfile_path:压缩文件路径
unzip_dir:解压缩路径
description:
‘’’
try:
logger.info(‘zipfile :’+zfile_path)
# name = os.path.split(zfile_path)[1]
# unzip_dir = os.path.join(unzip_dir, name.replace(’.zip’, ‘’))
logger.info(‘unzip_dir :’+unzip_dir)
if not os.path.exists(unzip_dir):
os.mkdir(unzip_dir)
with zipfile.ZipFile(zfile_path) as zfile:
zfile.extractall(path=unzip_dir)
return True
except zipfile.BadZipFile as e:
print(zfile_path + " is a bad zip file ,please check!")
return False
def load_json_file(file):
with open(file, ‘r’) as f:
ret = json.load(f)
return ret
def update_files(js):
try:
for floder in js:
if floder == ‘’:
continue
oprts = js[’{}’.format(floder)]
for oprt in oprts:
if oprt == ‘’:
continue
files = oprts[’{}’.format(oprt)]
for fd in files:
if fd == ‘’:
continue
f = files[’{}’.format(fd)]
# 目标路径
file_path = os.path.join(base_path, floder, f)
# 源路径
src = os.path.join(test_path, f)
if oprt == ‘update’:
shutil.copy(src, file_path)
elif oprt == ‘add’:
shutil.move(src, file_path)
elif oprt == ‘del’:
del_file(file_path)
except Exception as e:
print(e)
return False
# print(floder + ’ '+ oprt + ’ ’ + str(files))
return True
def update_file(folder=’’, client=None, addr=None, uuid=None, logger=None):
try:
global exelist
print(folder)
fds = os.listdir(folder)
for d in fds:
name = os.path.join(folder, d)
if os.path.isdir(name):
if d in exelist:
# print(d)
allfile = os.walk(name)
for root, dirs, files in allfile:
for f in files:
try:
fpath = os.path.join(base_path, d, f)
src = os.path.join(name, f)
# print(d + ' ' + src)
# print(fpath)
js = '{} updating {}--{}'.format(time.strftime(
"%Y-%m-%d %H:%M:%S", time.localtime()), d, f)
# logger.info(js)
# data = json.dumps({"cmd": 642, "sn": 3, "uuid": uuid, "body": {
# 'error': 0, 'result': 1, 'msg': js}})
# send(client, data, addr)
# shutil.copy(src, fpath)
print(js)
except Exception as e:
# logger.info(e)
# data = json.dumps({"cmd": 642, "sn": 3, "uuid": uuid, "body": {
# 'error': 1, 'result': 0, 'msg': 'Update {} Error {}'.format(js,e)}})
# send(client, data, addr)
continue
except Exception as e:
logger.info(e)
data = json.dumps({"cmd": 642, "sn": 3, "uuid": uuid, "body": {
'error': 1, 'result': 0, 'msg': '{} Error {}'.format(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()), e)}})
send(client, data, addr)
return True
def del_file(file):
if os.path.exists(file):
os.remove(file)
def fileMD5(filename):
m = hashlib.md5() # md5计算
with open(filename, ‘rb’) as f:
while True:
data = f.read(4096)
if len(data) == 0:
break
m.update(data)
return m.hexdigest()
def download(url, md5, client=None, addr=None, uuid=None, logger=None):
# txt = json.loads(js)
# url = txt[‘body’][‘address’]
# md5 = txt[‘body’][‘md5’]
# ‘http://116.6.229.133:8866/download?filename=update.zip’
r = requests.get(url, stream=True)
r.raise_for_status()
path = test_path
if not os.path.exists(path):
os.mkdir(path)
strs = url.split(’=’)
file = os.path.join(path, strs[-1])
all_size = int(r.headers[‘content-length’])
print(all_size)
all_chunk = 0
last_per = 0
with open(file, ‘wb’) as f:
for chunk in r.iter_content(chunk_size=1024):
if chunk:
f.write(chunk)
f.flush()
all_chunk += len(chunk)
rate = float(all_chunk) / float(all_size)
per = format(rate, “.2f”)
if all_chunk <= all_size and per != 0 and last_per != per:
last_per = per
show_per = ‘%.0f%%’ % (rate * 100)
if show_per == ‘0%’:
continue
# data = json.dumps({“cmd”: 642, “sn”: 3, “uuid”: uuid, “body”: {‘error’: 0, ‘result’: 1, ‘msg’: ‘{} Download Completed {}’.format(
# time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()), show_per)}})
# send(client, data, addr,logger)
# logger.info(data)
return file
弃用
def download_file(js=’’):
# js = r’{“cmd”: 555, “sn”: 2, “uuid”: “040082d087c335e3bd2b”, “body”: {“address”: “http://192.168.18.174:51200/1.1/4p_pickle.zip”, “md5”: “1cd227aa39580a1bb542f1a6fd5bd7ca”}}’
txt = json.loads(js)
url = txt[‘body’][‘address’]
md5 = txt[‘body’][‘md5’]
resp = requests.get(url)
path = test_path
if not os.path.exists(path):
os.mkdir(path)
strs = os.path.split(url)
file = os.path.join(path, strs[1])
with open(file, 'wb') as f:
f.write(resp.content)
return file
def load_config():
apps = []
try:
with open(conf_path, ‘r’) as f:
txts = f.readlines()
for txt in txts:
tmp = txt.split(’=’)
if len(tmp) > 1:
dname = tmp[0]
data = tmp[1].replace(’\n’, ‘’).replace(’\r’, ‘’)
apps.append(data)
except Exception as e:
print(e)
return apps
server_path = ‘C:\’
base_path = ‘C:\AZplat’
test_path = os.path.join(base_path, ‘test’)
def send(client, data, addr, logger=None):
jsbs = bytes(data, encoding=‘utf-8’)
client.sendto(jsbs, addr)
logger.info(data)
def stop_server_exe():
stop_exe(‘azs_tm.exe’)
stop_exe(‘azs_audio.exe’)
stop_exe(‘azs_mobile.exe’)
stop_exe(‘azs_pc.exe’)
stop_exe(‘azs_record.exe’)
stop_exe(‘azs_rob.exe’)
stop_exe(‘azs_client.exe’)
stop_exe(‘CenterManger.exe’)
def start_server_exe():
start_server(‘azs_tm’)
#start_server(‘azs_audio’)
#start_server(‘azs_mobile’)
#start_server(‘azs_pc’)
#start_server(‘azs_record’)
#start_server(‘azs_rob’)
#start_server(‘azs_client’)
def run_main0(js, logger=None, client=None, addr=None):
try:
# for exe in exelist:
# stop_exe(exe+’.exe’)
# print(‘stop all’)
txt = json.loads(js)
uuid = txt[‘uuid’]
stop_dog = txt[‘body’][‘stopdog’]
if uuid == “”:
return uuid
global exelist
exelist = load_config()
if stop_dog == '0':
global test_path
if not os.path.exists(test_path):
os.mkdir(test_path)
data = json.dumps({"cmd": 642, "sn": 3, "uuid": uuid, "body": {
'error': 0, 'result': 1, 'msg': '{} Start Download, Please Wait ......'.format(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))}})
send(client, data, addr, logger)
zipfile = download(js, client=client, addr=addr,
uuid=uuid, logger=logger)
data = json.dumps({"cmd": 642, "sn": 3, "uuid": uuid, "body": {
'error': 0, 'result': 1, 'msg': '{} Download Files Finish'.format(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))}})
send(client, data, addr, logger)
data = json.dumps({"cmd": 642, "sn": 3, "uuid": uuid, "body": {
'error': 0, 'result': 1, 'msg': '{} Superdog Service Stop, Start Update ......'.format(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))}})
send(client, data, addr, logger)
time.sleep(3)
# logger.info('stop Superdog Service')
stop_server(dog)
ret = unzip_file(zipfile, base_path, logger=logger)
if ret == True:
# logger.info('unzip done')
data = json.dumps({"cmd": 642, "sn": 3, "uuid": uuid, "body": {
'error': 0, 'result': 1, 'msg': '{} Unzip Files Finish'.format(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))}})
send(client, data, addr, logger)
else:
# logger.info('unzip done')
data = json.dumps({"cmd": 642, "sn": 3, "uuid": uuid, "body": {
'error': 1, 'result': 0, 'msg': '{} Unzip Files Error'.format(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))}})
send(client, data, addr, logger)
return uuid
time.sleep(2)
# client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# client.bind(('127.0.0.1', 5651))
shutil.rmtree(test_path)
test_path = os.path.join(base_path, 'test')
logger.info('update done')
data = json.dumps({"cmd": 642, "sn": 3, "uuid": uuid, "body": {
'error': 0, 'result': 1, 'msg': '{} Update Files Finish'.format(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))}})
send(client, data, addr, logger)
start_server(dog)
# logger.info('start dog done')
os.remove(zipfile)
# elif stop_dog == '1':
# # logger.info('stop Superdog Service')
# stop_server(dog)
# data = json.dumps({"cmd": 642, "sn": 3, "uuid": uuid, "body": {
# 'error': 0, 'result': 1, 'msg': '{} Superdog Service Stop, Start Update ......'.format(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))}})
# send(client, data, addr,logger)
# return uuid
# elif stop_dog == '2':
# start_server(dog)
# # logger.info('start dog done')
# data = json.dumps({"cmd": 642, "sn": 3, "uuid": uuid, "body": {
# 'error': 0, 'result': 1, 'msg': '{} Update Finish, Superdog Service Is Running'.format(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))}})
# send(client, data, addr,logger)
# return uuid
return uuid
except:
logger.error(traceback.format_exc())
data = json.dumps({"cmd": 642, "sn": 3, "uuid": uuid, "body": {
'error': 1, 'result': 0, 'msg': '{} Error {}'.format(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()), e)}})
send(client, data, addr, logger)
return uuid
def run_main(url, md5, logger=None, client=None, addr=None, update_type=None):
try:
global exelist
exelist = load_config()
global test_path
if not os.path.exists(test_path):
os.mkdir(test_path)
bat_path = ''
zipfile = download(url, md5)
calc_md5 = fileMD5(zipfile)
logger.info("update file: {},calc md5: {},server md5: {}".format(zipfile, calc_md5, md5))
if calc_md5 != md5:
logger.info('md5 calc error')
return False,bat_path
if update_type == 1:
stop_server(dog)
ret = unzip_file(zipfile, base_path, logger=logger)
bat_path = os.path.join(base_path,bat_file)
logger.info('bat file :'+bat_path)
time.sleep(2)
shutil.rmtree(test_path)
test_path = os.path.join(base_path, 'test')
start_server(dog)
elif update_type == 2:
stop_server_exe()
ret = unzip_file(zipfile, server_path, logger=logger)
bat_path = os.path.join(server_path,bat_file)
logger.info('bat file :'+bat_path)
time.sleep(2)
shutil.rmtree(test_path)
test_path = os.path.join(base_path, 'test')
start_server_exe()
else:
logger.info('update type error')
return False,bat_path
logger.info('successful')
return True,bat_path
except:
logger.error(traceback.format_exc())
return False,bat_path
if name == “main”:
# import socket
# import time
# s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# s.bind(('192.168.15.39', 5650))
# while True:
# data = s.recv(1024).decode('utf-8')
# print(data)
# if len(data) > 10:
# run_main(data)
# s.close()
# # print(test_path)
# exelist = load_config()
# update_file(test_path)
# # js=json.dumps({"cmd": 642, "sn": 3, "uuid": "040082d087c335e3bd2b", "body": {'error':0,'result':1,'msg':''}})
# js = r'{"cmd": 555, "sn": 2, "uuid": "040082d087c335e3bd2b", "body": {"address": "http://192.168.18.174:51200/3.0/AZplat3.0.zip", "md5": "1cd227aa39580a1bb542f1a6fd5bd7ca"}}'
# download(js)
# show_per = '%.0f%%' % (0.1002 * 100)
# print(show_per)
m = fileMD5(r'C:\test\server_update.zip')
print(m)```
install_run.bat
@echo on
set path=%Path%;C:\AZplat\py_update_service\py36-azupdate
start wmic ENVIRONMENT where "name='Path' and username='<system>'" set VariableValue="%Path%;C:\AZplat\py_update_service\py36-azupdate"
start python C:\AZplat\py_update_service\AzService.py --startup auto install
ping -n 3 127.0.0.1>nul
start python C:\AZplat\py_update_service\AzUpdateService.py --startup auto install
python C:\AZplat\py_update_service\AzService.py start
python C:\AZplat\py_update_service\AzUpdateService.py start
company.ini
[company]
id=1
server_ip=116.6.229.133
server_port=8866
stop_remove.bat
@echo off
set path=%Path%;C:\AZplat\py_update_service\py36-azupdate
start C:\AZplat\py_update_service\py36-azupdate\python.exe C:\AZplat\py_update_service\AzUpdateService.py stop
ping -n 3 127.0.0.1>nul
start C:\AZplat\py_update_service\py36-azupdate\python.exe C:\AZplat\py_update_service\AzUpdateService.py remove
start C:\AZplat\py_update_service\py36-azupdate\python.exe C:\AZplat\py_update_service\AzService.py stop
ping -n 3 127.0.0.1>nul
start C:\AZplat\py_update_service\py36-azupdate\python.exe C:\AZplat\py_update_service\AzService.py remove
ver.ini
0.0.0:d60bd00ce991aa8097ca4b59561edd|0.0.0:e48ab1742e2c7885a1b8d69684da16