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

Method get_service_pid

mod/project/python/serviceMod.py:183–196  ·  view source on GitHub ↗
(self, only_service: bool = False)

Source from the content-addressed store, hash-verified

181 return self.get_service_pid()
182
183 def get_service_pid(self, only_service: bool = False) -> Optional[int]:
184 pid = self.read_pid()
185 if pid and psutil.pid_exists(pid):
186 return pid
187
188 if not pid:
189 pid = self.get_pid_by_env_key()
190 if not pid and not only_service:
191 pid = self.get_pid_by_command()
192
193 if pid:
194 self.write_pid(pid)
195 return pid
196 return None
197
198 def get_pid_by_env_key(self) -> Optional[int]:
199 env_key = "BT_PYTHON_SERVICE_SID={}".format(self.sid)

Callers 6

startMethod · 0.95
stopMethod · 0.95
get_infoMethod · 0.95
handle_serviceMethod · 0.45
start_projectMethod · 0.45
other_service_pidsMethod · 0.45

Calls 5

read_pidMethod · 0.95
get_pid_by_env_keyMethod · 0.95
get_pid_by_commandMethod · 0.95
write_pidMethod · 0.95
pid_existsMethod · 0.45

Tested by

no test coverage detected