Jiyda Moussa
Jiyda Moussa

Reputation: 925

How to run two servers using one command line

I would like to have one command line that runs both the grunt server and the elasticSearch server.

To run grunt server, I do:

python manage.py gruntserver

To run elastic search, I do:

elasticsearch --config=/usr/local/opt/elasticsearch/config/elasticsearch.yml

I would like to simply run the following command and have both of the servers running:

make run

This is my attempt :

makefile:

run:
    echo "Setup..."
    elasticsearch --config=/usr/local/opt/elasticsearch/config/elasticsearch.yml
    echo "Running gruntserver"
    ./manage.py gruntserver

The problem is when one server is run, it doesn't run the next one.

Upvotes: 1

Views: 227

Answers (1)

Jiyda Moussa
Jiyda Moussa

Reputation: 925

This works:

makefile

run:
    echo "Making files executable"
    chmod +x manage.py
    chmod +x ../scripts/setup.sh
    echo "Setup..."
    ../scripts/setup.sh & ./manage.py gruntserver

Where setup.sh has:

elasticsearch --config=/usr/local/opt/elasticsearch/config/elasticsearch.yml

Upvotes: 1

Related Questions