My script looks like:
#!/bin/bash
myProgram1&
pidMyProgram1=$!
ssh myUserName@pluto
myProgram2&
pidMyProgram2=$!
function cleanup
{
kill -9 $pidMyProgram1 $pidMyProgram2
exit 0
}
trap cleanup SIGINT SIGTERM
while :
do
sleep 1
done
It does not work as I need it to. I am trying to launch two processes, one on another box called pluto. I want these two processes to run indefinitely until I hit control+c, then I want both processes to stop. When I run this I end up ssh'ed into pluto, but my processes aren't even running. Any ideas as to how I can handle my requirement of starting the process on a seperate box? I am pretty new to BASH...