Linux – Run netcat in background on Ubuntu Lucid 10.04

background-processlinuxnetcatnohuppostgresql

I am trying to do a pg_dump from one server and simultaneously restore at the other server.

The command on source server (192.168.3.94):

pg_dumpall -v  | nc 192.168.3.95  4000

The command on the target server (192.168.3.95):

nc -l 4000 | psql mydb

Now I am running this from my PC via Putty. Since this process take ~5 hours, I want to background the jobs and close the terminal windows. But I am not able to figure out how to background both commands and also exit the shell.

Help!

Best Answer

I'd use screen. If you run each end in a screen session, you can detach it (Ctrl-d) and log out while leaving it running.