do GenServer.start_link(__MODULE__, %{}) end def init(state) do Process.send_after(self(), :work, 0) # start immediately when starting {:ok, state} end def handle_info(:work, state) do # scraping from the train information page # find some trouble routes and notify LINE BOT API Process.send_after(self(), :work, 5 * 60 * 1000) # every 5 minutes {:noreply, state} end end