2 months ago
Hi i'm new with railways i need help my system will need to run php artisan schedule:work but i dont understand how to do this in railways i read some to create an empty service to run schedule:work or do cron job every 5 minute . its so confusing that i dont know how to implement it.
8 Replies
2 months ago
Hey, what you're looking for are cron jobs. Basically, you create a new service based on your repository and set a cron expression to run every minute, then set your start command accordingly.
am i doing it correct here ? something like this so basically i did one more service copy the variable from my web service to the scheduler that i named it and set it up like that ?



2 months ago
That looks correct, yes.
i already set the custom start command as php artisan schedule:run but after deployment it shows like these and i dont see on log it run the schedule work task that i set

its more like starting doing a cron job of starting web service every 5 minutes
2 months ago
I don't think the $PORT variable is available in that context. You need to wrap it in a shell command.
2 months ago
Example from the docs: /bin/sh -c "exec python main.py --port $PORT"
2 months ago
Also ensure that you can execute your artisan command in whatever the default shell directory is when the container starts. This will probably be correct but you might want to double check.