Guest User

Untitled

a guest
Oct 17th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # the open is done right away, reading however, is done only after a
  4. # connection is established to the unix domain socket. This keeps the file
  5. # around, and also "waits" for the last write from the producer process to
  6. # happen. (Tested with socat version 1.7.3.2(-1 debian testing)
  7. socat open:/proc/$PID/fd/$FD unix-listen:/tmp/$PID.$FD.sock &
  8.  
  9. # Wait until the producer process exits, then "retrieve" the file.
  10. socat unix-connect:/tmp/$PID.$FD.sock -> /tmp/the-file # -> it is!
Add Comment
Please, Sign In to add comment