I have long running process which is reading from STDIN
. However I am not sure which process is piping data into it. The process creation is handled by a process manager and I have no control over it. I tried using lsof
to figure it out, but I could not.
What would be a standard way to figure the process-id of the piping process?
This will give you what you want
pid=<THEPIDYOUWANT>; lsof | grep "$(lsof -nPFti -p $pid | grep -A1 tFIFO | sed -En 's/^i(.*)$/\1/p')"
the list of processes using the pipe will appear and from FD
you can tell which one reads or writes.