Qt daemon
-
Hello,
It ain't exactly flashy, but here's an alternative toQtService
if anyone would like to make use of it (Qt 5.5 compatible).(Copy from the readme)
There are two exposed classes
QDaemonApplication
andQDaemonLog
.QDaemonApplication
is derived fromQCoreApplication
and provides the basic infrastructure for the daemon.
QDaemonApplication
exposes 5 signals:daemonized()
- emitted when the application is started as a daemon/service by the OS and notifies the user that initializations (like connecting signals/slots) can be done.started()
- emitted when the application is run as a controlling terminal, notifying the user that the daemon/servicehas started.stopped()
- emitted when the application is run as a controlling terminal, notifying the user that the daemon/service has stopped.installed()
- emitted when the application is run as a controlling terminal, notifying the user that the daemon/service has been installed.uninstalled()
- emitted when the application is run as a controlling terminal, notifying the user that the daemon/service been uninstalled.
QDaemonLog
is the logging component for the daemon. It's set up to output onstdout
when the application is run as controlling terminal, and to a file (named after the application with .log extension) when the application is ran as daemon/service.
The logging component can be used by the user throughQDaemonLog & qDaemonLog();
coupled withQDaemonLog & << (const QString &)
orvoid qDaemonLog(const QString &, QDaemonLog::EntrySeverity)
. Currently the format of the output messages is fixed.Enjoy!
PS.
If you decide to use and find any bugs, please report them in the repo. -
This sounds good. Thanks for sharing this code
-
It seems I'm replying to myself, but I just wanted to let you know that after some (internal) refactoring. The library now supports command line arguments to be passed to the daemon/service as well (specified on
--install
/--fake
). However the library now requires Qt 5.6. -
Great. I went looking for something like this. Thanks for sharing.
A Question. Is this library stable? If not, when stable version will be released? -
Is this library stable? If not, when stable version will be released?
It depends on what you mean by stable.
If you mean the API, then probably you can safely say it's stable. I don't plan any (big) changes in the API. As for the binaries, it is binary compatible.
If you mean performance, I suppose it's stable enough. I have a project deployed with it and hadn't had any problems yet. Also it was reported by @madababi that the library works fine on Raspberry PI (with proper cross-compiling of course). There's always the possibility of minor bugs, but it should be fully functional.
Note There's currently no support for OSX.Kind regards.
-
This post is deleted!
-
Konstantin!
I am not very strong in English.
I would like to talk about your library.
Can we chat somewhere else?
Facebook? or somewhere else?