title: Unable to run cron tasks without phx.server running
body: <p>I'm developing an app in my desktop computer (Mac OS) for which I created some cron tasks that run every 5 minutes. The code is the following (taken from <a href="https://stackoverflow.com/questions/32085258/how-can-i-schedule-code-to-run-every-few-hours-in-elixir-or-phoenix-framework/32097971#32097971">here</a>):</p>
  
  <pre><code>defmodule MyApp.CronJobs do
    use GenServer
  
    @shops ["billa","kaufland","lidl"] 
  
    def start_link do
      GenServer.start_link(__MODULE__, %{})
    end
  
    def init(state) do
      schedule_work() # Schedule work to be performed at some point
      {:ok, state}
    end
  
    def handle_info(:work, state) do
      Enum.each(@shops, &amp;monitor_prices/1)
      schedule_work() # Reschedule once more
      {:noreply, state}
    end
  
    defp monitor_price(shop)
      Mix.Task.run "monitor.#{shop}.all_prices"
    end
  
    defp schedule_work() do
      Process.send_after(self(), :work, 5 * 60 * 1000)
    end
  end
  </code></pre>
  
  <p>On Supervision tree:</p>
  
  <pre><code>  ...
    children = [
      supervisor(MyApp.CronJobs, [])
      ...
    ]
    opts = [ strategy: :one_for_one, name: MyApp.Supervisor]
    Supervisor.start_link(children, opts)
  </code></pre>
  
  <p>The problem is this runs with the server, so whenever the computer goes on Sleep mode it stops running. </p>
  
  <p>Is there a way to have the processes running on the background permanently without having the computer all the time in Full Power mode? Even better, Is there a way to have mix Tasks triggered every 5 minutes without running the server?</p>