R
Railway•3w ago
Tarky

Execute a cron job every Sunday

Hello, I need to execute a cron job for my app which will modify something in the DB, I didn't find any examples or documentation regarding this. I am using Next.js, Postgress and DrizzleORM Any ideas?
28 Replies
Percy
Percy•3w ago
Project ID: N/A
Tarky
Tarky•3w ago
N/A
Brody
Brody•3w ago
do you already have a script to do your desired task?
Tarky
Tarky•3w ago
Do I need to create a new project and deploy it? Can I use my existing Next.js app and use a file as a cron-job?
Brody
Brody•3w ago
before we continue, please read this docs page so you can get your terminology correct. https://docs.railway.app/overview/the-basics
Tarky
Tarky•3w ago
If I understand correctly, I need to add a new service which will be the cron-job, right?
Brody
Brody•3w ago
correct, there you go!
Tarky
Tarky•3w ago
So I can create a new repo, add something like node-cron and deploy this service?
Brody
Brody•3w ago
not quite, you would want to use railways cron scheduler you can just have a script in your current repo to do your task, and have the cron service run it
Tarky
Tarky•3w ago
No description
Tarky
Tarky•3w ago
Is this the cron service you are talking about? I don't see where to add my script To point to my file which contains the script
Brody
Brody•3w ago
correct, and you would be looking for the start command, the start command is how you set the command that starts the script, for example node task.js
Tarky
Tarky•3w ago
No description
Tarky
Tarky•3w ago
this one?
Brody
Brody•3w ago
that's it of course as you mentioned, you would want to set this up on a duplicate service
Want results from more Discord servers?
Add your server