In my elixir application, I am implementing a cron job with this library https://github.com/quantum-elixir/quantum-core. Below is my code for the same.
defp deps do
[{:quantum, "~> 2.2"},
{:timex, "~> 3.0"}]
end
defmodule MyApp.Scheduler do
use Quantum.Scheduler,
otp_app: :my_app
end
defmodule MyApp.Application do
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
# This is the new line
worker(MyApp.Scheduler, [])
]
opts = [strategy: :one_for_one, name: MyApp.Supervisor]
Supervisor.start_link(children, opts)
end
end
Then i am configuring cron job to print message like this after every 1 min
config :my_app, MyApp.Scheduler,
jobs: [
{"* * * * *", fn -> IO.puts("Hello QUANTUM!") end}
]
How can I test whether cron job is working or not in my local.I tried to use mix run
but nothing seems to print the message even after the interval of 1 minute.