New answers tagged

0

Is there some general-purpose wrapper for stdin ... that lets one parse a shell command and then send the command's output to foo? Perhaps this may inspire you: $ echo pwd | sh / $ echo pwd | sh | wc 1 1 2 sh is a filter. It can read commands on stdin, run them, and emit their output on stdout.


2

Well, you can do: ls | socat - foo or: ls | socat -u - foo if you don't expect anything coming back from foo. Or with socat spawning ls: socat exec:ls foo If you mean you want to run a command while you run socat - foo in a terminal and have the output sent to foo, then within GNU screen, you can use: Ctrl+A:exec .!. ls which would run ls and ...


5

A port is considered "in use" whenever there are any sockets bound to it. They don't have to be in LISTEN state, just bound. Therefore the TIME_WAIT sockets that you see do count. It gets a little bit more complicated if any sockets are bound to addresses and ports. Different sockets are allowed to be bound to the same port if they're bound to different ...


1

AMQP requires the server-side of the connection to stay open if the client does not close the connection properly (for long-running tasks). Read more in this post. You can close those connections manually using rabbitmqctl or write a script that does that for you from a cron job, but both are rather ugly outside approaches to an application-level problem. ...


3

To answer your direct question, "what is the difference?": When you redirect from <&6, the shell uses a dup2() system call to duplicate the file descriptor. When you (attempt to) redirect from </dev/fd/6, it will use open(). The kernel doesn't support open() on sockets in /dev/fd; they are present in the directory for decoration information ...


5

It's so because reading from /dev/fd/ entries which represents sockets isn't implemented on Linux. You can find quite a good writeup on reasoning here. So you can call stat on the link, and that's why you see it with ls, but access is deliberately disallowed. Now for the second part - why does bash -c 'ls -l /dev/fd/6; cat <&6' ...



Top 50 recent answers are included