I have a python program that is running as a daemon on Linux.
How to send this daemon a signal from another python program?
Use os.kill to send signals. The signals are defined in the signal module. You'll just need to get the pid of the daemon in some way.
One more thing - you can use the signal module to register signal handlers as well.
If you need something more sophisticated than simple signals, consider using an RPC library like PYRO. The advantage of this is that you can use it even if you have to move your processes to separate servers.
Or, if you mainly target Linux systems, then look at using DBUS instead. There is a python library and it is now even supported on Windows.
Have you tried reading through the docs on interprocess communication in Python? Here is a link:
http://docs.python.org/library/ipc.html
Any other kind of signalling is possible, but these would probably be the most common.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With