mirror of https://github.com/nymea/nymea.git
Add systemd notify support
parent
cb9607498e
commit
bad240025d
|
|
@ -30,6 +30,7 @@ Build-Depends: debhelper (>= 9.0.0),
|
|||
libqt5serialport5-dev,
|
||||
libqt5serialbus5-dev,
|
||||
influxdb:native,
|
||||
libsystemd-dev,
|
||||
|
||||
|
||||
Package: nymea
|
||||
|
|
|
|||
|
|
@ -35,6 +35,14 @@ CONFIG(withoutpython) {
|
|||
CONFIG -= python
|
||||
}
|
||||
|
||||
packagesExist(systemd) {
|
||||
message(Building with systemd support)
|
||||
PKGCONFIG += systemd
|
||||
DEFINES += WITH_SYSTEMD
|
||||
} else {
|
||||
message(Building without systemd support)
|
||||
}
|
||||
|
||||
packagesExist(Qt5SerialBus) {
|
||||
message("Building with QtSerialBus support.")
|
||||
PKGCONFIG += Qt5SerialBus
|
||||
|
|
|
|||
|
|
@ -60,6 +60,10 @@
|
|||
#include <QDir>
|
||||
#include <QCoreApplication>
|
||||
|
||||
#ifdef WITH_SYSTEMD
|
||||
#include <systemd/sd-daemon.h>
|
||||
#endif
|
||||
|
||||
NYMEA_LOGGING_CATEGORY(dcCore, "Core")
|
||||
|
||||
namespace nymeaserver {
|
||||
|
|
@ -162,11 +166,18 @@ void NymeaCore::init(const QStringList &additionalInterfaces, bool disableLogEng
|
|||
connect(m_thingManager, &ThingManagerImplementation::loaded, this, &NymeaCore::thingManagerLoaded);
|
||||
|
||||
m_logger->log({"started"}, {{"version", NYMEA_VERSION_STRING}});
|
||||
#ifdef WITH_SYSTEMD
|
||||
sd_notify(0, "READY=1");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*! Destructor of the \l{NymeaCore}. */
|
||||
NymeaCore::~NymeaCore()
|
||||
{
|
||||
#ifdef WITH_SYSTEMD
|
||||
sd_notify(0, "STOPPING=1");
|
||||
#endif
|
||||
|
||||
qCDebug(dcCore()) << "Shutting down NymeaCore";
|
||||
m_logger->log({"stopped"}, {
|
||||
{"version", NYMEA_VERSION_STRING},
|
||||
|
|
|
|||
|
|
@ -24,9 +24,6 @@ LIBS += -L$$top_builddir/libnymea/ -lnymea \
|
|||
LIBS += -Wl,-rpath ../libnymea-core/
|
||||
}
|
||||
|
||||
CONFIG += link_pkgconfig
|
||||
PKGCONFIG += nymea-zigbee
|
||||
|
||||
# Server files
|
||||
include(qtservice/qtservice.pri)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue