MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / structure_start_script

Method structure_start_script

mod/project/nodejs/generalMod.py:113–139  ·  view source on GitHub ↗

@name 构造传统项目的启动脚本

(self, get)

Source from the content-addressed store, hash-verified

111
112 # 2024/7/13 上午10:21 构造传统项目的启动脚本
113 def structure_start_script(self, get):
114 '''
115 @name 构造传统项目的启动脚本
116 '''
117 last_env = self.get_last_env(get.nodejs_version)
118 node_bin = self.get_node_bin(get.nodejs_version)
119 env = "\n".join(["export {}".format(x) for x in get.env.split('\n')])
120 command = '''{last_env}
121{run_env}
122export NODE_PROJECT_NAME="{project_name}"
123cd {project_cwd}
124nohup {node_bin} {project_file} {project_args} &>> {log_file} &
125echo $! > {pid_file}
126'''.format(
127 last_env=last_env,
128 run_env=env,
129 project_cwd=get.project_cwd,
130 node_bin=node_bin,
131 project_file=get.project_file,
132 project_args=get.project_args,
133 log_file="{}/{}.log".format(self.node_logs_path, get.project_name),
134 pid_file="{}/{}.pid".format(self.node_pid_path, get.project_name),
135 project_name=get.project_name
136 )
137
138 public.writeFile(os.path.join(get.project_cwd, "{}_start.sh".format(get.project_name)), command)
139 get.project_script = command
140
141 # 2024/7/13 上午10:12 启动项目
142 def start_project(self, get):

Callers 2

create_projectMethod · 0.95
start_projectMethod · 0.95

Calls 6

get_last_envMethod · 0.95
get_node_binMethod · 0.95
writeFileMethod · 0.80
joinMethod · 0.45
formatMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected