ssh - running remote command not exiting

Hi,

i have a shellscript, where in i need to connect to different server start these three jobs and exit from the server and start the same three jobs on local server.

 
ssh user@remotehost 'bash -s' << EOF
${GETT_HOME}/bin/start1 &
sleep 10
${GETT_HOME}/bin/start2 &
sleep 10
${GETT_HOME}/bin/start3 &
echo "Started on secondary"
exit
EOF

script starts the jobs correctly on remote server however it never exits, ssh hungs at the end.

Appreciate your help

ssh hungs because the invoked processes are still running.
You can use fork option:

ssh -f  user@remotehost "${GETT_HOME}/bin/start1 &  sleep 10; ${GETT_HOME}/bin/start2 & sleep 10; ${GETT_HOME}/bin/start3 & echo Started on secondary "