Ok, FINALLY, I figured this one out, I'm *almost* sure
This was fairly challenging, but when I got home I tested with timed events to make sure it was working, and sure enough, my previous method (like yours) wasn't really working. Hostname and whoami run too fast to be useful alone, so I was thinking it worked, and it did not.
This, however, I'm pretty certain works. The sleeps have date then host unless it runs parallel.
user@host1:~$ ssh user@host2 " sh -c 'sleep 60;date >> test' & sh -c 'sleep 10; hostname >> test' "
user@host2's password:
<60 seconds elapses>
user@host2:~$ cat test
Host2
Mon Aug 24 21:32:25 MST 2009
So now I think I have it. By spinning off a sub-shell, you can break off the whole command... I think. It sure looks like it works, after what, like 4 attempts? LOL
There is still Expect