Control stript which is runing in background.
Cameron Simpson
cs at cskk.id.au
Fri Jan 1 16:13:24 EST 2021
On 01Jan2021 03:43, jak <nospam at please.ty> wrote:
>Maybe the fact that I'm not English and I don't know the language well
>doesn't allow me to express myself clearly. Try it one more time:
>The OP would like to give some command to a script that is running. How?
>With a script that sends commands to it. One of the ways, as mentioned,
>is by using a mini socket server. Given the needs of the OP and the fact
>that sockets are a limited resource in a system, I took the liberty of
>proposing a simple alternative: using a named pipe, also because, IMO,
>sockets, in this case, are an overkill. with a few lines of code in a
>thread in the running script they can allow it to receive commands:
You're right. For receive only of small things this is pretty simple.
Not to mention much easier on the command sender:
echo "my command" >the-named-pipe
I'm sorry for conflating the concurrency and return-a-response needs of
a full blown client/server app with the much simpler request of the OP:
to control a daemon simply. I've even done exactly what you suggested
myself.
I think it's pretty clear that you're aware of the difference in
behaviours and semantics between UNIX named pipes (unidirection shared
single channel) with sockets (bidirection distinct multichannels).
Cheers,
Cameron Simpson <cs at cskk.id.au>
More information about the Python-list
mailing list