I may have missed the documentation about this, but I’d like to know how can I run multiple process in parralel, in a web service?
Can I run multiple commands using
&& in the single start command?
I know it’s not expected to work like that, but sometimes I just want to avoid creating another web service, to make some savings.
Thanks for reaching out.
The Build Command can essentially be thought of as a bash prompt, you can run whatever shell commands are required to setup your project.
command && command will work just fine, or if the commands are not dependent on the previous succeeding,
command; command; would also work. You mention running “multiple process in parallel”, however both these techniques would run the commands sequentially.
If you’re needing to do a lot of build setup it’s often tidier to create a shell script in your project (e.g.
render_build.sh) and define that as your Build Command
Hope that helps
I was specifically talking about the
start command, not the
build one. Does your answer is still valid in that case?
Let’s say I want to run a Django server + a Celery worker in that same start command, is it ok
(assuming we’re ok with this pretty bad practice generally speaking)?
Apologies, my mistake, I went down the “build command” route when you said “start”
Yes, you can certainly start multiple processes on a service if you wanted, but as you noted it wouldn’t be particularly good practice.
& in bash run commands in the background so that may be one approach to start multiple services, e.g.
command & command. Or if there’s a Python equivalent to Foreman/Forego that parses
Procfiles maybe that could be another solution.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.