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