0

The following repeated task need to be automated using bash script in OSx El Capitan.
open new terminal tab, go to a directory run a command on this directory to start meteor server, repeat the above 2 more times but in different directory and with slightly different commands.

The command to open run meteor is:

MONGO_URL='mongodb://username:password@cluster0-shard-00-00-oko1k.mongodb.net:27017,cluster0-shard-00-01-oko1k.mongodb.net:27017,cluster0-shard-00-02-oko1k.mongodb.net:27017/dbname?ssl=true&replicaSet=Cluster0-shard-0&authSource=dbforadmin' meteor

The other 2 commands append --port=4000 and --port=5000 to the above.

I googled for now avail. Any ideas? Thanks

1

bash itself doesn't know anything about tabs; that's a GUI thing. However, you can use a tool such as screen to run multiple concurrent jobs. More detail will be needed about your 'different directories' and other alterations to the iterated command, but in short:

$ screen -dmS Example 'sleep 30'

The above command will open a screen session as a background task called 'Example' which will execute sleep 30 and then terminate. You can reattach to the session to interact with or view the output of the command with screen -x Example. For more information, see man screen.

  • The terminals running in different tabs are needed to view the output during app development. ~/path1/ ~/path2/ and ~/path3/ need to have the meteor server running for different apps all at the same time. – Fred J. Sep 1 '17 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.