Creating Oban job with cron expression

Hi Guys. This is first time using oban for scheduling periodic job
I want to send emails to all subscribed user at the last day of month and save result to database.

in config.exs

{Oban.Plugins.Cron,
     crontab: [
       {"55 23 30 4,6,9,11 *",MyApp.EmailWorker, args: %{type: "emails"}},
       {"55 23 31 1,3,5,7,8,10,12 *", MyApp.EmailWorker,
        args: %{type: "emails"}},
       {"55 23 28 2 *", MyApp.EmailWorker, args: %{type: "emails"}}
     ]}

In EmailWorker.ex

defmodule MyApp.EmailWorker do
  use Oban.Worker, queue: :emails, max_attempts: 3

  @impl Worker
  def perform(oban_job) do
     Subscribers.all()
     |> Enum.map(fn subscriber ->
         content = "some content"
         send_email(subscriber, content) |> save_to_database()
      end)
  end
end
  1. This will insert cron job at last day of the month and will do the job?
  2. How can I test if it is scheduled correctly?

You could simplify the schedule by sending at midnight on the first day of the month. However, there isn’t any mechanism for testing a cron schedule—you need to trust that Oban will respect the pattern you set.