Update index.py

pull/109/head
midoks 6 years ago
parent 36693178ef
commit 0cf0219f27
  1. 17
      plugins/memcached/index.py

@ -85,14 +85,12 @@ def initDreplace():
os.mkdir(initD_path) os.mkdir(initD_path)
file_bin = initD_path + '/memcached' file_bin = initD_path + '/memcached'
# if os.path.exists(file_bin): if not os.path.exists(file_bin):
# return file_bin content = public.readFile(file_tpl)
content = content.replace('{$SERVER_PATH}', service_path)
public.writeFile(file_bin, content)
public.execShell('chmod +x ' + file_bin)
content = public.readFile(file_tpl)
content = content.replace('{$SERVER_PATH}', service_path)
public.writeFile(file_bin, content)
public.execShell('chmod +x ' + file_bin)
return file_bin return file_bin
@ -171,6 +169,7 @@ def saveConf():
# 设置memcached缓存大小 # 设置memcached缓存大小
import re import re
confFile = getConf() confFile = getConf()
print confFile
try: try:
args = getArgs() args = getArgs()
content = public.readFile(confFile) content = public.readFile(confFile)
@ -179,8 +178,8 @@ def saveConf():
content = re.sub('MAXCONN=\d+', 'MAXCONN=' + args['maxconn'], content) content = re.sub('MAXCONN=\d+', 'MAXCONN=' + args['maxconn'], content)
content = re.sub('CACHESIZE=\d+', 'CACHESIZE=' + content = re.sub('CACHESIZE=\d+', 'CACHESIZE=' +
args['cachesize'], content) args['cachesize'], content)
public.writeFile(confFile, content) print public.writeFile(confFile, content)
reload() restart()
return 'ok' return 'ok'
except Exception as e: except Exception as e:
pass pass

Loading…
Cancel
Save