LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Pipe between two daemons? (https://www.linuxquestions.org/questions/linux-general-1/pipe-between-two-daemons-4175464524/)

vbsaltydog 06-03-2013 01:56 AM

Pipe between two daemons?
 
I have a script that must remain in php and run as a service and another script that must remain in python and run as a service. I need the first script to send data to the second script.

I have achieved this by echoing the data out of the first script so it gets sent to stdout and using a pipe to send it to the second script that listens to stdin and responds to the data as it receives it.

This works great when I call the scripts from the shell as:

Code:

script1.php | script2.py
This does not work when the aforementioned code is run as a service by systemd because systemd sends stdout to journald and there seems to be no way around that.

I have also tried to send the data from script1 to a named pipe where script2 reads from the same named pipe.

Again, works great until I try to daemonize the process.

Distro is Arch and this also cannot be changed.

Any help is appreciated.

pan64 06-03-2013 03:01 AM

(probably) You can have bidirectional communication between two python processes and you can fork that php task in one of them (which will inherit sockets).

vbsaltydog 06-03-2013 04:42 PM

I got it working by running the commands via sh in the systemd service files.


All times are GMT -5. The time now is 06:10 AM.