I need to set up a couple of ssh-tunnels from a shell script. I've tried running them as bg tasks using:
#!/bin/sh ssh -L 3000:server1:5029 me@server2 & ssh -L 3001:server3:3306 me@server2 &
but the tunnels don't seem to work correctly when I launch them that way.
They work fine when I manually set them up in their own tabs, so my next idea is to have the script open new tabs in Terminal and run the commands in there as foreground processes.
Note: this question was originally "How do I launch a new terminal tab from the shell and then run a command in it?", but I got two answers about dealing with the tunnels. For the "opening a shell" question, I found this on SuperUser, which will work , though new tabs in the background would be preferable to the foreground windows that it opens.