There is an application written in Qt. It should be spinning on the server. The application is currently not stable, it sometimes falls. It is necessary that someone (something) would track his fall and start the process again, automatically.

Offer your options.

  • one
    You do not need to write applications on Qt, which will then work on the server. - Pavel Mayorov

3 answers 3

If the application does not require a visual interface (or it is implemented by a separate module), start it as a service and use the regular service restart mechanism for problems.

  • "written in Qt" - Pavel Mayorov
  • So what? The "Windows" tag came from somewhere ... or applications on QT fundamentally cannot work like a service? - Akina
  • Qt is like a UI library - Pavel Mayorov
  • The presence of a window interface does not mean that it is used. And if used - not the fact that there is no alternative access. Again, if the application is running on a server, then it is likely that the presence of an operator interacting with it is not provided, and the interface itself is simply a means of visual control or real-time reconfiguration. There is again a chance that the main functionality is concentrated in the non-visual modules. In the end, it is up to the author to decide whether the application will use the “service” approach or not. - Akina

Lots of options: the buggy application creates Mutex, and the tracking application checks it with the necessary frequency. The application fell, the mutex disappeared - we restart it.
The witnessing process checks for the presence of a buggy by name, sorting through all the processes at regular intervals.
The third is DebugAPI, but this is much more complicated.

    At the command prompt:

    for /l %q in (0) do start /wait notepad.exe 

    under bat'nik it is necessary to correct a little.