Removed dependency and restored ports
This commit is contained in:
parent
c7a9e6ccb5
commit
f64408f584
|
@ -6,14 +6,15 @@ start(MonitorPid, File) ->
|
||||||
|
|
||||||
init(MonitorPid, File) ->
|
init(MonitorPid, File) ->
|
||||||
Cmd = "/usr/bin/tail -n0 --follow=name " ++ File,
|
Cmd = "/usr/bin/tail -n0 --follow=name " ++ File,
|
||||||
Port = open_port({spawn, Cmd}, [stderr_to_stdout, {line, 256}, exit_status, binary]),
|
Port = open_port({spawn, Cmd}, [stderr_to_stdout, exit_status, binary]),
|
||||||
loop(MonitorPid, Port).
|
loop(MonitorPid, Port).
|
||||||
|
|
||||||
loop(MonitorPid, Port) ->
|
loop(MonitorPid, Port) ->
|
||||||
receive
|
receive
|
||||||
{Port, {data, {eol, Bin}}} ->
|
{Port, {data, {eol, Bin}}} ->
|
||||||
%% io:format("~s~n", [iolist_to_binary(Bin)]),
|
|
||||||
Text = binary_to_list(iolist_to_binary(Bin)),
|
Text = binary_to_list(iolist_to_binary(Bin)),
|
||||||
MonitorPid ! {log_line, Text},
|
MonitorPid ! {log_line, Text},
|
||||||
loop(MonitorPid, Port)
|
loop(MonitorPid, Port);
|
||||||
|
{Port, {exit_status, _Status}} ->
|
||||||
|
io:format("Watcher terminated~n")
|
||||||
end.
|
end.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[
|
[
|
||||||
{ log_monitor,
|
{ log_monitor,
|
||||||
[
|
[
|
||||||
{logfiles, ["/tmp/lines.log", "/tmp/lines2.log"]},
|
{logfiles, ["/tmp/lines.log"]},
|
||||||
{email_config,
|
{email_config,
|
||||||
[
|
[
|
||||||
{sender, "me@example.com"},
|
{sender, "me@example.com"},
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
{erl_opts, [debug_info]}.
|
{erl_opts, [debug_info]}.
|
||||||
{deps, [
|
{deps, [
|
||||||
{gen_smtp, ".*", {git,"https://github.com/Vagabond/gen_smtp", {tag, "0.12.0"}}},
|
{gen_smtp, ".*", {git,"https://github.com/Vagabond/gen_smtp", {tag, "0.12.0"}}}
|
||||||
{erlexec, ".*", {git,"https://github.com/saleyn/erlexec", {tag, "1.6.4"}}}
|
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
{relx, [{release, { log_monitor, "0.1.0" },
|
{relx, [{release, { log_monitor, "0.1.0" },
|
||||||
|
|
Loading…
Reference in New Issue
Block a user