Last active
November 8, 2021 17:46
-
-
Save Gabrimarin/ddd8dbc6927995bfc2a2a69f39035a3f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule KV do | |
def processaMensagem(itm) do | |
if (elem(itm, 0) == :file_event) do | |
System.cmd("rsync", ["-r", "path/", "lapada@192.168.201.100:/home/lapada/destino"]) | |
end | |
end | |
def receiver() do | |
receive do | |
msg -> processaMensagem(msg) | |
end | |
KV.receiver() | |
end | |
def watch() do | |
{:ok, pid} = FileSystem.start_link(dirs: ["path"]) | |
FileSystem.subscribe(pid) | |
KV.receiver() | |
end | |
end | |
KV.watch() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment