currently I am working with multiple platfrom like react js , elasticsearch & node js.
whenever i start all service i need run these commands one by one
sudo systemctl start elasticsearch.service
cd API-React/Fastapi-Elasaticsearch/
uvicorn main:app --reload --port 8000
cd alpha_app/API-React/
npm start
cd alpha_app/reactvideo/react-node-video-streaming/server/
npm run dev
I need to run these all comments one by one instead of that how to create .sh file and start all the service through .sh
file
Thanks
CodePudding user response:
To create bash scripts you can simply create a file, for instance vi script.sh
and paste your commands inside. It will execute it one by one. You can try this bash script to automate running commands. To run script use command bash script.sh
#!/bin/bash
sudo systemctl start elasticsearch.service
cd API-React/Fastapi-Elasaticsearch/
uvicorn main:app --reload --port 8000
cd alpha_app/API-React/
npm start
cd alpha_app/reactvideo/react-node-video-streaming/server/
npm run dev