Using ssh to execute a remote script in the background

Help please!!

I want to use ssh to execute a remote exe and while it's running I want to query for the process ID of the exe (2 different ssh commands)

  1. sshpass -p "<passwd>" ssh -f -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@<ipaddress> nohup /tmp/mmds_asyn &

  2. sshpass -p "<passwd>" ssh -f -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@<ipaddress> pidstat -t|grep mmds_asyn &

  3. Other ssh commands to send kill -s events to the process ID acquired

However step 1) does not work for me. I execute step 1) and the process mmds_asyn is not running on the remote machine??

Can you help me fix this please??

---------- Post updated at 06:35 PM ---------- Previous update was at 06:16 PM ----------

Apparently pidstat is not the right tool for querying - used ps -e and it worked!!!