I am writing a script that opens a
netcat process remotely on a server which listens for input and redirects it to a file:
ssh $remote_upload_user@remote_upload_address "nc -l -p $remote_port > $remote_dir/$backup.gz&"
The script proceeds to compress the ZFS snapshot through
pigz and then sends the data as input to
netcat $remote_upload_address -u $remote_port < $(zfs send -R $zpool@label | pigz)
|pv to the end of
pigz (within the parentheses) it shows that
pigz is processing the data, but once the data passes to
netcat I get a never ending stream of garbled data flooding stdout on the client side.
The server shows 0 size in increase for the file it needs to be writing to. Why isn't this working?