[Docs] Cron Jobs

AnonymousTRIAL

a year ago

Discussion thread for Documentation Topic: Cron Jobs.

Link: https://docs.railway.app/guides/cron-jobs

12 Replies

gbrldevPRO

7 months ago

Hello, I would like to know how I can configure a cron job to execute a file that is in the project.


7 months ago

By setting your start command to run the the file.


xcarloseduardoxFREE

5 months ago

What time zone does it have? I want it to run at 11 am in my country Mexico,


5 months ago

They run on the UTC timezone.


nunommcTRIAL

2 months ago

Hi

I have 3 services (db, worker and rails server). By using the "whenever" gem I exported the list of services we currently have on another hosting solution.

1. I tried defining the crontab on the worker but:

  • it doesn't allow the below with the error "Sorry, but that's not a valid cron expression" - I understand now this is intended to define the schedule for the start command

0 7 * * * rails name_of_task
  • it doesn't allow adding more than one crontab entry

The only article that mentions Rails and Crontab, talks about Sidekiq. Having that I don't want to add that dependency as I'm using DelayedJobs how could I get the crontab to be correctly set up?

2. I tried defining the crontab on the web server but it just shows the message below, and documentation doesn't refer to it anywhere.

Cron schedules are not available for serverless services

The solution will be that we need to add a 4th service to run the cronjobs with sidekiq-cron?

Thanks


2 months ago

We don't use crontab.

You would want a new Railway service in your project for every cron job you want to run.

You set the cron schedule in the service settings, and on the same service you set a start command, the start command is what is executed on the schedule.


intaek-hHOBBY

24 days ago

What is the start command? Is it just a command that runs on deployment success event?

I'm confused if that's something like the custom deploy command


intaek-h

What is the start command? Is it just a command that runs on deployment success event?I'm confused if that's something like the custom deploy command

intaek-hHOBBY

24 days ago

I'm asking because I want to add a dedicated command for the cron job but the naming confuses me.


23 days ago

The start command is the command that is started upon start, it is what would be ran every job run.


vmrochaHOBBY

16 days ago

The fact that I need to keep an entire separate service to run a cron job with the same exact app as the Web app is sad. Isn't there an alternative?


vmrocha

The fact that I need to keep an entire separate service to run a cron job with the same exact app as the Web app is sad. Isn't there an alternative?

16 days ago

I'd love to hear what would be your ideal alternative, and why specifically a seperate service to do a seperate function is not ideal.


alex-deliaPRO

15 days ago

Is there any info on how using a separate service cron vs a scheduling library in the main server might affect costs? Obviously the task is the same in both, but could starting up the service every time its needed potentially have higher usage/costs?