Tool to execute commands in multiple directories

A few months back I was working on a project which had a SOA(Service Oriented Architecture). Which means I had to start 4 to 5 services from different directories to start my workflow. And it was important to monitor the logs as well. For a few days I just executed the commands by going in different directories but then after that I thought enough is enough. I am a programmer I can write programs to make my life easier. Thats when I wrote this tool called bring_it_on. Its written in nodejs.

How bring_it_on works

bring_it_on takes a configuration file and uses aliases to operate on an service or a command. If you pass the service alias to the bring_it_on it will start that particular service and it will show logs in different color for each service prepended with its alias.

To kill the service I used SIGINT signal. Pressing Ctrl+c will kill all the services started by bring_it_on.

Below is a sample configuration file that bring_it_on understands. alias is a key to the command. brint_it_on will identify the service/command using that alias.

Now to run the services present in config I just had to type a command from one place. Below is the command I used to run to start the services.

At first it was pretty cool but then I realized the command is very big so I put an alias inside my ~/.zshrc file. And then I could run any service from any directory.

Below is a screen shot of terminal after using bring_it_on

bring_it_on

Now starting the services was a lot easier but then I had a use case where I wanted to start all the services except one or two of them. And then I extended brint_it_on to do that. After the changes I was able to start services except the ones which I didn’t need at the moment.

How to install bring_it_on

  1. git clone git@github.com:ajitsing/bring_it_on.git
  2. cd bring_in_on
  3. npm install
  4. modify config.json according to your needs
  5. add your preferred alias to ~/.bashrc or ~/.zshrc

and done.

About Ajit Singh

Hi, I am Ajit Singh, author of singhajit.com. I work on a lot of different technologies and tools. I started my career as a software engineer in Chennai (India) and recently I moved to Gurgaon near to my home town. I like reading and writing about technology.

Leave a Reply

Your email address will not be published. Required fields are marked *