How can I run a Ruby script in a daily cronjob?

I need to run a simple script daily with specific parameters like this. When I run it manually:

bundle exec rails runner auto_send_messages_script.rb --messages-limit 3 --sleep-timer 5 --marker welcome_back_campaign_2025 --order-type created_at ā€”-order desc

I see no errors and everything is fine, Iā€™m new to Ruby and wonder if there is an easy way to run this script and interact with Discourse.

1 Like

The Discourse (and Rails) way of doing this would be to create a plugin and run it as a scheduled (sidekiq) Job.

There are loads of plugins with Jobs, have a look through them.

3 Likes

From an application-development point of view:

:100:

From a systems point of view:

Easiest thing to do is run it on the host.

3 Likes