Laravel cron jobs

How can I run php artisan schedule:work every minute?
17 Replies
Percy
Percy16mo ago
Project ID: N/A
saakashvili(mefe)
saakashvili(mefe)OP16mo ago
N/A
Brody
Brody16mo ago
railway's cron jobs are limited to every 15 minutes
saakashvili(mefe)
saakashvili(mefe)OP16mo ago
15 minutes is ok But where can I configure cron job command?
saakashvili(mefe)
saakashvili(mefe)OP16mo ago
Brody
Brody16mo 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)
saakashvili(mefe)OP16mo ago
Then how can I connect to the main service? should I upload files there too?
Brody
Brody16mo ago
doesn't this only do stuff with the database?
saakashvili(mefe)
saakashvili(mefe)OP16mo ago
yes but when you run php artisan schedule:run command it needs "artisan" file to run scheduled commands
Brody
Brody16mo ago
of course, so you deploy your code into another service, just set a different start command
saakashvili(mefe)
saakashvili(mefe)OP16mo ago
Ok thank you
saakashvili(mefe)
saakashvili(mefe)OP16mo ago
I created new service for crons but it ran only once
Brody
Brody16mo 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)
saakashvili(mefe)OP16mo ago
How can i do that?
Brody
Brody16mo 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)
saakashvili(mefe)OP16mo ago
Ok thank you!
Brody
Brody16mo ago
no problem!
Want results from more Discord servers?
Add your server