Setting up Cron Job
dmwangike
HOBBYOP

9 months ago

I want to use a Cron job to create a balance snapshot on Postgresql. I have created python script to invoke the procedures on the database so as to perform this snapshot. I have been looking for a way to schedule it, but I cannot find a place to define the job I want to run. on the +Cron Schedule I am only seeing where to do the schedule timings but not define the job I want to run. What could be the problem?

Solved$10 Bounty

Pinned Solution

idiegea21
HOBBY

9 months ago

Railway’s Cron Scheduler works a bit differently than a traditional system cron. It’s designed to trigger HTTP endpoints or Railway services not directly run scripts or shell commands.

That’s likely why you’re not seeing a place to define the job logic itself. Railway expects the logic to live inside a deployed service or exposed HTTP route. I think you should either convert your Python script into a Railway service, or use a command-based worker service instead.

Could you let me know:

  • Whether your Python script is already part of a deployed Railway project?

  • If not, would you prefer to expose it via an HTTP endpoint or just have it run as a background worker?

3 Replies

9 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 9 months ago


idiegea21
HOBBY

9 months ago

Railway’s Cron Scheduler works a bit differently than a traditional system cron. It’s designed to trigger HTTP endpoints or Railway services not directly run scripts or shell commands.

That’s likely why you’re not seeing a place to define the job logic itself. Railway expects the logic to live inside a deployed service or exposed HTTP route. I think you should either convert your Python script into a Railway service, or use a command-based worker service instead.

Could you let me know:

  • Whether your Python script is already part of a deployed Railway project?

  • If not, would you prefer to expose it via an HTTP endpoint or just have it run as a background worker?


idiegea21

Railway’s Cron Scheduler works a bit differently than a traditional system cron. It’s designed to trigger HTTP endpoints or Railway services not directly run scripts or shell commands.That’s likely why you’re not seeing a place to define the job logic itself. Railway expects the logic to live inside a deployed service or exposed HTTP route. I think you should either convert your Python script into a Railway service, or use a command-based worker service instead.Could you let me know:Whether your Python script is already part of a deployed Railway project?If not, would you prefer to expose it via an HTTP endpoint or just have it run as a background worker?

dmwangike
HOBBYOP

9 months ago

Yes, my Python script is part of my deployment. You could also share a link on how to implement the second option (that is, using HTTP).


dmwangike

Yes, my Python script is part of my deployment. You could also share a link on how to implement the second option (that is, using HTTP).

dmwangike
HOBBYOP

9 months ago

Thanks @idiegea21, I managed to research based on your directions and deployed a scheduled service


Status changed to Open sarahkb125 9 months ago


Status changed to Solved sarahkb125 9 months ago


Loading...