class/projectModel/javaModel的start_project的project_cmd 后面加入
project_jar = project_find["project_config"]['project_jar']
修改后代码片段如下:
- if project_find['project_config']['java_type']=='springboot':
- project_cmd=project_find["project_config"]['project_cmd']
- project_jar = project_find["project_config"]['project_jar']
- # 前置准备
- log_file = project_find["project_config"]['logs']
- pid_file= project_find["project_config"]['pids']
- # 启动脚本
- cmd = project_cmd
- start_cmd = '''#!/usr/bin/python
- # coding: utf-8
- # Date 2021/12/14
- #coding: utf-8
- import os,sys
- panelPath = os.getenv('BT_PANEL')
- os.chdir(panelPath)
- if not '/class/' in sys.path:
- sys.path.insert(0,panelPath + "/class/")
- import public
- import subprocess
- pid_file="{pid_file}"
- log_file="{log_file}"
- cmd="{cmd}"
- jar_work_dir = os.path.dirname(os.path.realpath("{jarFileName}"))
- with open(log_file,"a") as out:
- process = subprocess.Popen(cmd,stdout=out,cwd=jar_work_dir)
- pid = process.pid
- public.WriteFile(pid_file,str(pid))
- '''.format(pid_file=pid_file,log_file=log_file,cmd=cmd,jarFileName=project_jar)
复制代码
实测日志里面的路径变对了。 |