Open Terminal.app but hold open

bashsshterminal

I have a shell script that runs on my mac (./go), it opens a ssh session on a raspberry pi then runs a script which streams video from the raspberry pi to a UDP port on the mac.

I also need the mac to run a receive script (./tsplay) so it can view the streamed video.

The problem is that I have tried to use the command open -a Terminal.app ./tsplay before the SSH session is started, a new terminal window opens but it doesn't wait for stream data to come in and it exits – [Process completed]

#!/bin/bash

source network.conf

rm remote.conf

if [ "$1" != "" ] 
then
  sed "s/FRAMERATE=25/FRAMERATE=$1/" video.conf > remote.conf
else
  cp video.conf remote.conf
fi

open -a Terminal.app ./tsplay 

date
echo "###### Network Settings ######" >> remote.conf
echo export TCPPORT=$TCPPORT >> remote.conf
echo export UDPPORT=$UDPPORT >> remote.conf
echo export RX_IP=$RX_IP >> remote.conf
echo export NOW=\"`date +%F" "%T`\" >> remote.conf

#echo exit >> remote.conf

chmod +x remote.conf

echo Copy script to $TX_IP
scp remote.conf $USER@$TX_IP:/home/pi

echo Run Script
ssh $USER@$TX_IP ./ustream
ssh $USER@$TX_IP

Best Answer

Why do you want to run tsplay in a Terminal anyway? Surely it is a graphical app if it displays video? Why not do a sleep for a while to let the Pi start sending and then start tsplay to receive?

fi
...
(sleep 5; ./tsplay ) &
...
date