Cron jobs

how can i set a schedule task on railway
19 Replies
Percy
Percy9mo ago
Project ID: 3816f047-82a7-4031-9ac7-fc29d8840ac5
luffytaro
luffytaroOP9mo ago
3816f047-82a7-4031-9ac7-fc29d8840ac5
luffytaro
luffytaroOP9mo ago
yes i did but i set a cron schedule and it dont work like a im expected my project is a laravel api, i already set the schedule task and y set de cron job on railway
Brody
Brody9mo ago
cron jobs on railway need to run and then exit as soon as possible, otherwise they just simply aren't cron jobs
luffytaro
luffytaroOP9mo ago
I don't know what you mean, in Laravel to execute the jobs you need to execute the following command php artisan schedule:run
Brody
Brody9mo ago
that's a long running task, you cant use railway cron for that, you'd just have that running as a regular service
luffytaro
luffytaroOP9mo ago
Ok, how can I execute the command automatically?
Brody
Brody9mo ago
as mentioned, in a separate railway service
luffytaro
luffytaroOP9mo ago
o saw a templete https://blog.railway.app/p/cron-jobs is this the service tath you mentioned
Railway Blog
Cron Jobs on Railway
A brief guide on deploying and running cron jobs on Railway using JavaScript.
Brody
Brody9mo ago
that has absolutely nothing to do with anything I've been saying though? you need to run php artisan schedule:run in a separate railway service, nothing at all to do with cron
luffytaro
luffytaroOP9mo ago
ok but how?
Brody
Brody9mo ago
create a new service in the project, set any needed service variables, set the start command, attach your github repo
luffytaro
luffytaroOP9mo ago
ok perfect but how it execute the comand automatically
Brody
Brody9mo ago
it's ran when the service starts
luffytaro
luffytaroOP9mo ago
i now but it need to restart when i need to execute, will the cron job restar automatically the service ?
Brody
Brody9mo ago
again, cron has nothing to do with this, it's its own scheduler, I recommend you read the docs on what that command does
luffytaro
luffytaroOP9mo ago
ok now I know how it works thanks for the help and sorry for the inconvenience
Brody
Brody9mo ago
no worries, going forward please try to have an understanding of the technologies you are using in your project
Want results from more Discord servers?
Add your server