win2016server系统中,我想用python代码停止和启动MySQL和apache服务,然后做备份文件
哪位帮忙看看 谢谢
while 1:
time.sleep(1)
nowtime=time.strftime("%Y%m%d%H%M%S",time.localtime())
if nowtime=="20221024093705":
time.sleep(10)
commandMySQL=["net stop mysql", "net start mysql"]
os.system = commandMySQL[0]
shutil.copytree('E:/mysql',f'E:/321/{nowtime}/mysql')
time.sleep(30)
os.system = commandMySQL[1]
print("备份完成")
运行结果及报错内容
不能停止服务