Nп/п : 19 из 60
 От   : David Brown                         2:5075/128        08 авг 23 12:27:35
 К    : pozz                                                  08 авг 23 13:33:11
 Тема : Re: Linux Embedded: how to get info from a running service
----------------------------------------------------------------------------------
                                                                                 
@MSGID: 1@dont-email.me> 746a61f6
@REPLY: 1@dont-email.me> 963ef695
@REPLYADDR David Brown <david.brown@hesbynett.no>
@REPLYTO 2:5075/128 David Brown
@CHRS: CP866 2
@RFC: 1 0
@RFC-Message-ID: 1@dont-email.me>
@RFC-References: 1@dont-email.me>
@TZUTC: 0200
@PID: Mozilla/5.0 (X11; Linux x86_64; rv:60.0)
Gecko/20100101 Thunderbird/60.6.1
@TID: FIDOGATE-5.12-ge4e8b94
On 07/08/2023 23:28, pozz wrote:
> 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.

I don`t know what kind of information you are needing, but an easy 
option might be to have the python service regularly write out a json 
format file with the current status or other information.  The web app 
can have Javascript that regularly reads that file and handles it on the 
user`s web browser.  And if you want to go the other way, your Python 
code can use "inotify" waits to see file writes from the web server.



--- Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1
 * Origin: A noiseless patient Spider (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх