pozz
2023-08-07 21:28:25 UTC
I developed an application (in Python language) that is started by
systemd at startup and stay running forever (until the box is rebooted
or shutdown).
The user can get some info of the system by a web application, as a
typical router or NAS. The user points his web browser to the local IP
address of my Linux box and a graphical interface appears. This web
application is written in Python (WSGI) deployed on the box thanks to
nginx + gunicorn + Flask.
Now the question is: how to get infos from a running service such that
they can be shown on the web application?
The infos are specific of my application, they aren't standard. I'm in
control of the running service and WSGI application, so I can use
whatever solution is better.
Of course this is a typical IPC scenario: one process is WSGI and the
other is the running service.
I can use shared memory, message queues, named pipes, unix sockets,
Internet sockets, D-Bus and many other mechanisms.
Is there one that is better to use in my case? After some reading, maybe
D-Bus can be a good way. I understood systemd already uses D-Bus to
exchange infos about its services and units.
However its implementation is not straightforward as a unix socket with
custom messages.
What do you suggest?
PS: In the past I read only a few posts regarding Linux development,
even if it's for embedded devices. However I don't know how to ask
questions related to linux development, I noticed Usenet linux groups
are somewhat dead.
systemd at startup and stay running forever (until the box is rebooted
or shutdown).
The user can get some info of the system by a web application, as a
typical router or NAS. The user points his web browser to the local IP
address of my Linux box and a graphical interface appears. This web
application is written in Python (WSGI) deployed on the box thanks to
nginx + gunicorn + Flask.
Now the question is: how to get infos from a running service such that
they can be shown on the web application?
The infos are specific of my application, they aren't standard. I'm in
control of the running service and WSGI application, so I can use
whatever solution is better.
Of course this is a typical IPC scenario: one process is WSGI and the
other is the running service.
I can use shared memory, message queues, named pipes, unix sockets,
Internet sockets, D-Bus and many other mechanisms.
Is there one that is better to use in my case? After some reading, maybe
D-Bus can be a good way. I understood systemd already uses D-Bus to
exchange infos about its services and units.
However its implementation is not straightforward as a unix socket with
custom messages.
What do you suggest?
PS: In the past I read only a few posts regarding Linux development,
even if it's for embedded devices. However I don't know how to ask
questions related to linux development, I noticed Usenet linux groups
are somewhat dead.