I set up something so that I'd open up 3 shells and run the programs one by one:
cd foo/bar
./foo.sh
cd foo/bar
node bar.js
cd foo/bar
ruby foobar.rb
However, since it is time consuming, so I wrote a shell script to do it:
cd foo/bar
./foo.sh &
node bar.js &
ruby foobar.rb
However, when I press CTRL-C to stop this script, the other 2 programs are still running. If I type
jobs
it won't show the background processes (probably belongs to the script) -- if it did, I could have used fg
to bring them to the foreground and press CTRL-C on them one by one, so I have to do
ps ax | grep foo
ps ax | grep bar
to find the process ids and then kill the processes.
Is there a better way to automate the process to open up 3 shells and run 3 programs so that they are like how I open up 3 shells and run them? I don't care about the STDOUT output, so if one shell window is divided into 3 parts, that's ok.
Can tmux, emacs, or any other tool achieve this goal? (I am not familiar with tmux or emacs enough to know if it is possible).