I have a program called
mdr-dev that I execute and that as a result opens port 1022.
After opening that port, I have to leave the program running to keep that port open. The snag is that it takes some time to execute so in the mean time I should wait for it to open that port!
Once the port is open, I want to open a new terminal and
ssh through that port to a remote device.
The question is: How to write a bash or any other script for this?
(I already tried with the sleep command but it does not seem to work.)
Here is what I've tried so far:
#!/bin/bash echo $MDR_ROOT mdr-dev --root --mount /opt/tile/home /home --tunnel 1022 22
mdr-dev command above's initialisation process, I want to automatically open a new terminal and run:
ssh -p 1022 root@localhost
Off course, I already tried:
--tunnel 1022 22 & sleep 5m xterm -hold -e ssh -p 1022 root@localhost
but that doesn't seem to work...
How should I proceed?