keepalived 脚本模板

This commit is contained in:
Mr Chen
2023-11-16 19:16:14 +08:00
parent 9da7f04379
commit 5dc97276c1
3 changed files with 132 additions and 7 deletions
+12 -6
View File
@@ -144,12 +144,18 @@ def copyScripts():
src_scripts_path = getPluginDir() + '/scripts'
dst_scripts_path = getServerDir() + '/scripts'
if not os.path.exists(dst_scripts_path):
cmd = 'cp -rf ' +src_scripts_path+' '+dst_scripts_path
t = mw.execShell(cmd)
acl_cmd = 'chmod +x '+dst_scripts_path+'/*.sh'
# print(acl_cmd)
mw.execShell(acl_cmd)
# print(t)
mw.execShell('mkdir -p ' + dst_scripts_path)
olist = os.listdir(src_scripts_path)
for o in range(len(olist)):
src_file = src_scripts_path+'/'+olist[o]
dst_file = dst_scripts_path+'/'+olist[o]
content = mw.readFile(src_file)
content = contentReplace(content)
mw.writeFile(dst_file, content)
cmd = 'chmod +x ' + dst_file
mw.execShell(cmd)
return True
return False