#1 2022-05-15 16:54:51

igors233
Member
Registered: 2012-09-10
Posts: 241

mormot.app.daemon and services

ServiceStateText in mORMot2 has error, it was copied from mORMot1 when enum state as text was converted so it removed first two chars (ssStopped-> Stopped)
In ver2 there's an SERVICESTATE const array so there's no need for conversion, it should simply be:
Result := _SERVICESTATE[State];


BTW, TSynDaemon reacts only based on command line arguments, I think it would be an improvement to allow switches (/start/install...) to be called manually. For example I want to control how application starts (as a service, console, or GUI) from ini/json settings, not from a command line.

Offline

#2 2022-05-16 08:09:51

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,652
Website

Re: mormot.app.daemon and services

You are right.
I have remoted ServiceStateText() in favor of plain ToText().
https://github.com/synopse/mORMot2/commit/fedb84b9

For your purpose, I have added a new TSynDaemon.Command alternate execution method.
But note that it is of little use, because the daemon is executed in the context of the daemon service, not a third-party application.
https://github.com/synopse/mORMot2/commit/eed1cc75

Online

#3 2022-05-16 16:54:28

igors233
Member
Registered: 2012-09-10
Posts: 241

Re: mormot.app.daemon and services

Thanks, it works perfectly for what I need. I have three types of working modes in same app, as a service, gui or console. Gui mode could be a standalonea app or configurator/installer/monitor for service mode.

Offline

Board footer

Powered by FluxBB