Update index.py

pull/109/head
midoks 7 years ago
parent 0ad6947a31
commit 9fe362fff1
  1. 29
      plugins/openresty/index.py

@ -68,28 +68,35 @@ def confReplace():
content = public.readFile(getConf()) content = public.readFile(getConf())
content = content.replace('{$SERVER_PATH}', service_path) content = content.replace('{$SERVER_PATH}', service_path)
user = 'www'
user_group = 'www'
# macosx do # macosx do
if public.getOs() == 'darwin': if public.getOs() == 'darwin':
user = public.execShell( user = public.execShell(
"who | sed -n '2, 1p' |awk '{print $1}'")[0].strip() "who | sed -n '2, 1p' |awk '{print $1}'")[0].strip()
user_group = 'root' # user = 'root'
content = content.replace('{$OS_USER}', 'root') user_group = 'staff'
content = content.replace('{$OS_USER_GROUP}', user_group)
content = content.replace('{$EVENT_MODEL}', 'kqueue') content = content.replace('{$EVENT_MODEL}', 'kqueue')
else: else:
content = content.replace('{$OS_USER}', 'www') user = 'www'
content = content.replace('{$OS_USER_GROUP}', 'www') user_group = 'www'
content = content.replace('{$EVENT_MODEL}', 'epoll') content = content.replace('{$EVENT_MODEL}', 'epoll')
exe_bin = getServerDir() + "/bin/openresty" content = content.replace('{$OS_USER}', user)
# exe_bin = getServerDir() + "/nginx/sbin/nginx" content = content.replace('{$OS_USER_GROUP}', user_group)
public.execShell('chown root:root ' + exe_bin)
public.execShell('chmod 755 ' + exe_bin)
public.execShell('chmod u+s ' + exe_bin)
public.writeFile(getServerDir() + '/nginx/conf/nginx.conf', content) public.writeFile(getServerDir() + '/nginx/conf/nginx.conf', content)
exe_bin = getServerDir() + "/bin/openresty"
print public.execShell('chown -R ' + user + ':' + user_group + ' ' + exe_bin)
print public.execShell('chmod 755 ' + exe_bin)
print public.execShell('chmod u+s ' + exe_bin)
nginx_exe_bin = getServerDir() + "/nginx/sbin/nginx"
print public.execShell('chown -R ' + user + ':' + user_group + ' ' + nginx_exe_bin)
print public.execShell('chmod 755 ' + nginx_exe_bin)
print public.execShell('chmod u+s ' + nginx_exe_bin)
def initDreplace(): def initDreplace():

Loading…
Cancel
Save