linux-kernelraspberry-pidaemonpython-daemon

Send message to a Python daemon script from another init script without using IPC


I have an python daemon init script that has to get messages from other init script when they are starting.Since it is the initial boot stage of my raspberry Pi board i don't want to use any IPC for message passing.Is there any simple way that i can pass message from my other init scripts to python daemon.Thanks in advance for any great suggestions for this issue.


Solution

  • You can use named pipe. First you instantiate named pipe using mkfifo, which creates file representing the pipe. Then you open this file in both scripts - in one for writing and in another one for reading. After that you can just write some data to the opened file in one script and read it back in another.

    Note that pipes are unidirectional, which means that if you need to communicate in both directions, then you need to create two pipes.