Question:
I need to run many commands one by one to start my project instead of that i tried to put commands on shell script fileserver.sh
.sh
file, now problem is after uvicorn main:app --reload --port 8000
this command sh files failed to execute rest of the commands.how to resolve this using
.sh
file or yaml
fileAnswer:
You must run in background the three main scripts in your code:uvicorn main:app --reload --port 8000 &
npm start &
npm run dev &
That
&
is used after a command to run this one in background, so the script will not stop in the first command (avicorn) and it will follow with the code.And because of those commands will generate an output in the terminal (in the case you are running them from it) that output can be confused, so I would recommend redirect the output to a file for every command you run in background.
Your code could be like this:
If you have better answer, please add a comment about this, thank you!