1

I want to start two different databases but want to keep each process running in a separate tab in a terminal. How do I do this within a shell script? I currently have the following code:

#! /bin/bash
mysqld &
redis-server

Each database needs its own tab. This is on OSX.

AlexINF
  • 225
  • 2
  • 17
pmdaly
  • 1,142
  • 2
  • 21
  • 35
  • tabs? You want two *interactive* shell windows to input/output some info to db? Then, why not to run them in separate shells? For monitoring output, you could also redirect your output to *log files*. [Also you can start *screen*](http://stackoverflow.com/a/1781533/1566267): `screen -S 'itismysqld' -d -m mysqld`, then, later attach: `screen -r itismysqld` – John_West Jan 05 '16 at 23:28

1 Answers1

1
osascript -e 'tell application "Terminal" to activate' -e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down' -e 'tell application "Terminal" to do script "mysqld" in selected tab of the front window'

(based on https://stackoverflow.com/a/7177891/1566267)

The similar command is for redis-server.

Community
  • 1
  • 1
John_West
  • 2,239
  • 4
  • 24
  • 44