This is a messy situation and I may (as in allowed) not explain why I need to do this but I do need it (if possible).
M1, M2 and M3 are all Linux.
I have a machine M1 on one side of the world that is connecting to M2 using ssh. The command executed on M2 creates a big zip file which has to be FTPd to M3.
It is a requirement that the file must be sent from M2 to M1 before it is shipped to M3. Yes, it would be faster and simpler if I could transfer it from M2 to M3, but that's not an option.
Is it possible to set something up that will allow a file to be copied from M2 to a location on M1 such that any file that appears there will automagically get FTPd directly to M3?
The transfer from M2 to M3 can be a regular cp command because the location on M2 is an NFS mount point visible from M1. There is no access to M3 except via FTP.
Is there a magic ssh tunnel incantation that I can use? Or are there any other suggestions? The bottom line is that the command originates on M1 but the transfer must be from M1 to M3.