From f4b9f80f34e3c1e56f6bfc69a0e85fe0611f87f4 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 12 Apr 2019 19:35:47 +0100 Subject: Write last update time to systemd service status --- gentoobrowse-api/etc/service.conf | 1 + gentoobrowse-api/service/Jamfile.jam | 2 ++ gentoobrowse-api/service/maintenanceGitOperations.cpp | 3 +++ 3 files changed, 6 insertions(+) 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 : : : : /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 : xslt exslt esmtp + systemd ..//dbppcore ..//IceBox ..//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 +#include 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"); -- cgit v1.2.3