This commit is contained in:
midoks
2018-12-08 14:43:32 +08:00
parent 2106746f6c
commit dbeb919f05
5 changed files with 31 additions and 5 deletions
+17 -2
View File
@@ -51,6 +51,18 @@ def getInitDTpl():
return path
def makeConf():
import shutil
vhost = getServerDir() + '/nginx/conf/vhost'
if not os.path.exists(vhost):
os.mkdir(vhost)
source_vhost = getPluginDir() + '/conf/nginx_status.conf'
dest_vhost = vhost + '/nginx_status.conf'
# if not os.path.exists(dest_vhost):
shutil.copyfile(source_vhost, dest_vhost)
def confReplace():
service_path = os.path.dirname(os.getcwd())
content = public.readFile(getConf())
@@ -61,7 +73,7 @@ def confReplace():
user = public.execShell(
"who | sed -n '2, 1p' |awk '{print $1}'")[0].strip()
user_group = 'root'
content = content.replace('{$OS_USER}', user)
content = content.replace('{$OS_USER}', 'root')
content = content.replace('{$OS_USER_GROUP}', user_group)
content = content.replace('{$EVENT_MODEL}', 'kqueue')
@@ -72,7 +84,7 @@ def confReplace():
exe_bin = getServerDir() + "/bin/openresty"
# exe_bin = getServerDir() + "/nginx/sbin/nginx"
public.execShell('chown midoks:root ' + exe_bin)
public.execShell('chown root:root ' + exe_bin)
public.execShell('chmod 755 ' + exe_bin)
public.execShell('chmod u+s ' + exe_bin)
@@ -98,6 +110,9 @@ def initDreplace():
# config replace
confReplace()
# make nginx vhost or other
makeConf()
return file_bin