ssh a nohup command

I have a script I'm creating to spawn netcat listeners on a remote server for copying files at high speeds. The issue I'm running into is that after running the "nohup nc -l -p 12345 | tar -xvf - &" commands I can't get the remote shell to terminate. I'm not sure if this is working as intended or I'm missing something, but a simple test can reproduce the same results:

At a bash shell run the following:

nohup sleep 1000 &

exit

The shell clears screen and hangs until the sleep process is killed or finishes. If you check the process though you can see the shell is no longer the parent process:

[root@test ~]# ps -fea |grep sleep |grep -v grep
root 6990 1 0 12:15 ? 00:00:00 sleep 1000

So, beyond having a comment in my script to have users "ctrl-c" to continue, does anyone have a more elegant solution to kill the shell on the remote server?

Try the at command:

ssh me@remotenode 'at now <<!
some command that takes a long time 
!
'

note the last ' on a line by itself...

If users are going to buzz bomb the remote node with this command you need to modify the /etc/crond.d/queuedefs file to set the at queue to a larger size and to a nice value.
Note queuedefs is in different places/different names on different boxes. It usually lives with at.deny.

Also, the user account for the ssh needs "at" privileges

Worked like a charm. Thanks Jim!

 
ssh user@test 'at now <<ENDOFSSH
nc -l -p 12345 | tar -xvf - 
ENDOFSSH
'