fix
This commit is contained in:
parent
819ac30a5a
commit
ee1c025cd5
@ -95,21 +95,14 @@ init([ContainerId]) ->
|
|||||||
%% supervisor进程通过exit(ChildPid, shutdown)调用的时候,确保terminate函数被调用
|
%% supervisor进程通过exit(ChildPid, shutdown)调用的时候,确保terminate函数被调用
|
||||||
erlang:process_flag(trap_exit, true),
|
erlang:process_flag(trap_exit, true),
|
||||||
|
|
||||||
ExecCmd0 = <<>>,
|
case startup(<<>>, []) of
|
||||||
Args0 = [],
|
{ok, Port} ->
|
||||||
PortSettings = [
|
|
||||||
{args, [binary_to_list(A) || A <- Args0]},
|
|
||||||
exit_status
|
|
||||||
],
|
|
||||||
ExecCmd = binary_to_list(ExecCmd0),
|
|
||||||
case catch erlang:open_port({spawn_executable, ExecCmd}, PortSettings) of
|
|
||||||
Port when is_port(Port) ->
|
|
||||||
{os_pid, OSPid} = erlang:port_info(Port, os_pid),
|
{os_pid, OSPid} = erlang:port_info(Port, os_pid),
|
||||||
lager:debug("[efka_service] service: ~p, port: ~p, boot_service success os_pid: ~p", [ContainerId, Port, OSPid]),
|
lager:debug("[efka_service] service: ~p, port: ~p, boot_service success os_pid: ~p", [ContainerId, Port, OSPid]),
|
||||||
{ok, #state{container_id = ContainerId, port = Port, os_pid = OSPid}};
|
{ok, #state{container_id = ContainerId, port = Port, os_pid = OSPid}};
|
||||||
_Other ->
|
{error, Reason} ->
|
||||||
lager:debug("[efka_service] service: ~p", [ContainerId]),
|
lager:debug("[efka_service] service: ~p", [ContainerId]),
|
||||||
{stop, <<"exec command startup failed">>}
|
{stop, Reason}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% @private
|
%% @private
|
||||||
@ -187,7 +180,7 @@ handle_cast(_Request, State = #state{}) ->
|
|||||||
{stop, Reason :: term(), NewState :: #state{}}).
|
{stop, Reason :: term(), NewState :: #state{}}).
|
||||||
%% 重启服务
|
%% 重启服务
|
||||||
handle_info({timeout, _, reboot_service}, State = #state{service_id = ServiceId, manifest = Manifest}) ->
|
handle_info({timeout, _, reboot_service}, State = #state{service_id = ServiceId, manifest = Manifest}) ->
|
||||||
case efka_manifest:startup(Manifest) of
|
case startup(Manifest, []) of
|
||||||
{ok, Port} ->
|
{ok, Port} ->
|
||||||
{os_pid, OSPid} = erlang:port_info(Port, os_pid),
|
{os_pid, OSPid} = erlang:port_info(Port, os_pid),
|
||||||
lager:debug("[efka_service] service_id: ~p, reboot success, port: ~p, os_pid: ~p", [ServiceId, Port, OSPid]),
|
lager:debug("[efka_service] service_id: ~p, reboot success, port: ~p, os_pid: ~p", [ServiceId, Port, OSPid]),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user