Laravel cron jobs

How can I run php artisan schedule:work every minute?
17 Replies
Percy
Percy12mo ago
Project ID: N/A
saakashvili(mefe)
N/A
Brody
Brody12mo 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
Brody12mo 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
Brody12mo 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
Brody12mo 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
Brody12mo 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
Brody11mo 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
Brody11mo ago
no problem!