summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-04-12 19:35:47 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2019-04-12 19:56:49 +0100
commitf4b9f80f34e3c1e56f6bfc69a0e85fe0611f87f4 (patch)
treef8bbea4e56f1c178441a79bc68c588f7e6935fe4
parentIgnore fall-through warning in generated code (diff)
downloadgentoobrowse-api-f4b9f80f34e3c1e56f6bfc69a0e85fe0611f87f4.tar.bz2
gentoobrowse-api-f4b9f80f34e3c1e56f6bfc69a0e85fe0611f87f4.tar.xz
gentoobrowse-api-f4b9f80f34e3c1e56f6bfc69a0e85fe0611f87f4.zip
Write last update time to systemd service status
-rw-r--r--gentoobrowse-api/etc/service.conf1
-rw-r--r--gentoobrowse-api/service/Jamfile.jam2
-rw-r--r--gentoobrowse-api/service/maintenanceGitOperations.cpp3
3 files changed, 6 insertions, 0 deletions
diff --git a/gentoobrowse-api/etc/service.conf b/gentoobrowse-api/etc/service.conf
index 39afe49..ee83ffd 100644
--- a/gentoobrowse-api/etc/service.conf
+++ b/gentoobrowse-api/etc/service.conf
@@ -1,3 +1,4 @@
[Service]
User=portage
Group=portage
+NotifyAccess=main
diff --git a/gentoobrowse-api/service/Jamfile.jam b/gentoobrowse-api/service/Jamfile.jam
index 84adc44..2256701 100644
--- a/gentoobrowse-api/service/Jamfile.jam
+++ b/gentoobrowse-api/service/Jamfile.jam
@@ -21,6 +21,7 @@ lib exslt ;
lib xslt : : : : <include>/usr/include/libxslt ;
lib slicer-xml ;
lib esmtp ;
+lib systemd ;
lib gentoobrowse-service++11 :
[ glob-tree *.cpp : bin ]
@@ -34,6 +35,7 @@ lib gentoobrowse-service++11 :
<library>xslt
<library>exslt
<library>esmtp
+ <library>systemd
<library>..//dbppcore
<library>..//IceBox
<library>..//slicer
diff --git a/gentoobrowse-api/service/maintenanceGitOperations.cpp b/gentoobrowse-api/service/maintenanceGitOperations.cpp
index 396ff5a..3249e0a 100644
--- a/gentoobrowse-api/service/maintenanceGitOperations.cpp
+++ b/gentoobrowse-api/service/maintenanceGitOperations.cpp
@@ -13,6 +13,7 @@
#include "utils/git.h"
#include "converters.impl.h"
#include <compileTimeFormatter.h>
+#include <systemd/sd-daemon.h>
namespace Gentoo {
namespace Service {
@@ -173,6 +174,8 @@ namespace Gentoo {
auto changes = refreshRepository(dbc.get(), properties, repo);
this->applyFileChanges(dbc.get(), repoRoot, repo, changes);
}
+ time_t now = time(nullptr);
+ sd_notifyf(0, "STATUS=Last update %s", ctime(&now));
}
AdHocFormatter(UpdatingFileContent, "Updating file content\n");