FYI i have script setup to do a automatic restore of a full P1 environment (hurray open server!). The script ssh()es to the backup server, starts a tar -zxvf of the backup, pipes the stream of the tar output over ssh, which goes into a jump server which pipes the tar stream into a ssh session into the replication host, which takes stdin into a tar command to dump the backup into a given dir. What i noticed was firing up mds restore (mdsstart after mds_restore) would hang things up on the script when called over ssh. The fix was to close stdin on the mdsstart. Not sure why but this will stop mdsstart from hanging the ssh session.

I'm also forcing /etc/profile to be read so maybe something out of that is making mdsstart hang around. Not sure but this works FYI.

ssh $1 "bash -c 'source /etc/profile ; mdsstart < /dev/null'"