Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not getting any sort of events out #2

Open
ciokan opened this issue Oct 10, 2016 · 2 comments
Open

Not getting any sort of events out #2

ciokan opened this issue Oct 10, 2016 · 2 comments

Comments

@ciokan
Copy link

ciokan commented Oct 10, 2016

Just used the code from your README with a watch on /var/log/syslog. No events are being sent out

require Logger

defmodule Fail2ban.Watcher do
    use GenServer

    def start_link(name \\ nil) do
        GenServer.start_link(__MODULE__, nil, [name: name])
    end

    def init(state) do
        watch()
        {:ok, state}
    end

    def watch do
        Logger.info "Setting up syslog listener"

        {:ok, receiver_pid} = Fail2ban.Receiver.start_link

        Fwatch.watch_file "/var/log/syslog", fn _path, events ->
            IO.inspect events # Nothing printed upon modifying syslog
        end
    end
end
@ryo33
Copy link
Owner

ryo33 commented Oct 10, 2016

I'll add the new inferface to solve this problem like this:

{:ok, pid} = Fwatch.start_link(:syslog_watcher, "/var/log")
Fwatch.watch_file(pid, "/var/log/syslog", callback)

But this doesn't work on the current version(0.9.2) of fs.
Why Is :fs.start_link/2 Undefined?

@ryo33
Copy link
Owner

ryo33 commented Nov 19, 2016

@ciokan
I added the API.
Since it can not be published to hex.pm yet it can be used by specifying {:fwatch, github: "ryo33/fwatch", branch: "master"}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants