Laravel cron jobs

How can I run php artisan schedule:work every minute?
17 Replies
Percy
Percy15mo ago
Project ID: N/A
saakashvili(mefe)
N/A
Brody
Brody15mo ago
railway's cron jobs are limited to every 15 minutes
saakashvili(mefe)
15 minutes is ok But where can I configure cron job command?
Brody
Brody15mo ago
you would want to make a new service, set the cron job, and then set the start command in the service settings
saakashvili(mefe)
Then how can I connect to the main service? should I upload files there too?
Brody
Brody15mo ago
doesn't this only do stuff with the database?
saakashvili(mefe)
yes but when you run php artisan schedule:run command it needs "artisan" file to run scheduled commands
Brody
Brody15mo ago
of course, so you deploy your code into another service, just set a different start command
saakashvili(mefe)
Ok thank you
saakashvili(mefe)
I created new service for crons but it ran only once
Brody
Brody15mo ago
ah right, you need to configure your app to exit after the cron job runs railway will not re-run the cron job if your app is still running
saakashvili(mefe)
How can i do that?
Brody
Brody15mo ago
i just looked it up php artisan schedule:work starts its own scheduler, this command should not be run on a cron schedule, just use it as your start command and remove the cron stuff from the service
The schedule:work command will run in the foreground and invoke the scheduler every minute until you terminate the command
saakashvili(mefe)
Ok thank you!
Brody
Brody15mo ago
no problem!
Want results from more Discord servers?
Add your server