Any tutorial out there on how to set up CRON jobs?
kefrankefran7609
PROOP

2 months ago

I don't find any clear info/tutorial/example on how to set up CRON jobs.
I see the CRON schedule in my project with an input where I can add the schedule, but what how do I set up the endpoint(s) it should trigger?
I can't believe Railway doesn't have a 2min tutorial or a proper example in their documentation, this part is really not intuitive in their dashboard.

Solved$10 Bounty

2 Replies

yellowmacaroni
PRO

2 months ago

It says "run the service according to the specified cron schedule" - it will run the service, not a specific endpoint. If you want to do that, you can just set up a function with a cron schedule that fetches a specific endpoint.


adam
MODERATOR

2 months ago

^ This exactly. Think of Railway's cron like the entire service turning off, then turning back on with its start command on that cron schedule


adam
MODERATOR

2 months ago

You might be looking for Railway functions running on a cron schedule, to hit that service's endpoint
https://docs.railway.com/reference/functions


adam
MODERATOR

a month ago

!s


Status changed to Solved adam about 2 months ago


kefrankefran7609
PROOP

a month ago

I still have no idea how to create a cron job with Railway.
There is literally not 1 single example, walkthrough or tutorial on this on the internet and it's not intuitive at all.
Railway needs to step it up.
I understand that I have to create a cron job through a function.
Ok, but what next?
Do I create the function in my existing project or does it have to be a project of itself?
If it's in the same project, does this function has access to my main project and can call a function from there?
Do I need to create a cron.ts or something?
Should I just be calling API endpoints I already created, since I was using Vercel before, and that's how it worked.
Please, anybody take 5min to share a loom video or clear info on this.
Thanks in advance


Status changed to Awaiting Railway Response Railway about 1 month ago


passos
MODERATOR

a month ago

Railway has a whole docs for cron jobs in case you need it: https://docs.railway.com/reference/cron-jobs but it differs from Vercel as it runs an application instead of calling an endpoint.

For using Railway functions to call your endpoint, use the attached video as a reference.

Attachments


Status changed to Solved sarahkb125 about 1 month ago


Loading...