gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-deployment] branch master updated: try log adapter f


From: gnunet
Subject: [GNUnet-SVN] [taler-deployment] branch master updated: try log adapter for blog frontend
Date: Thu, 18 Jan 2018 15:20:26 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository deployment.

The following commit(s) were added to refs/heads/master by this push:
     new 7aaf11b  try log adapter for blog frontend
7aaf11b is described below

commit 7aaf11b8ae6b9d9c8e7cef546887015fda1f1a54
Author: Florian Dold <address@hidden>
AuthorDate: Thu Jan 18 15:20:16 2018 +0100

    try log adapter for blog frontend
---
 bin/taler-log-adapter     | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 taler-arm/taler-blog.conf |  4 ++--
 2 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/bin/taler-log-adapter b/bin/taler-log-adapter
new file mode 100755
index 0000000..caf47e0
--- /dev/null
+++ b/bin/taler-log-adapter
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+# This file is part of GNU TALER.
+# Copyright (C) 2018 INRIA
+#
+# TALER is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free 
Software
+# Foundation; either version 2.1, or (at your option) any later version.
+#
+# TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
details.
+#
+# You should have received a copy of the GNU Lesser General Public License 
along with
+# GNU TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
+#
+# @author Florian Dold
+
+from subprocess import Popen, PIPE
+import sys
+import os
+import os.path
+import signal
+import time
+
+def handler(signum, frame):
+    if p:
+        os.kill(p.pid, signal.SIGINT)
+p = None
+if len(sys.argv) < 3:
+    print("Usage: {} logfile prog_and_args...".format(sys.argv[0]), 
file=sys.stderr)
+    sys.exit(-1)
+signal.signal(signal.SIGINT, handler)
+p = Popen(sys.argv[2:], stderr=PIPE, shell=False)
+log = sys.argv[1]
+dir = os.path.dirname(log)
+if dir:
+    os.makedirs(os.path.dirname(log), exist_ok=True)
+while p.poll() is None:
+    full_name = time.strftime(log)
+    last_read = p.stderr.readline()
+    if last_read == '':
+        break
+    with open(full_name, "ab") as f:
+        f.write(last_read)
+status = p.wait()
+sys.exit(status)
diff --git a/taler-arm/taler-blog.conf b/taler-arm/taler-blog.conf
index 3a42093..76f0654 100644
--- a/taler-arm/taler-blog.conf
+++ b/taler-arm/taler-blog.conf
@@ -1,4 +1,4 @@
 [taler-blog]
 TYPE = simple
-BINARY = taler-merchant-blog
-OPTIONS = serve-uwsgi
+BINARY = taler-log-adapter
+OPTIONS = $HOME/logs/exchange-%Y-%m-%d.log taler-merchant-blog serve-uwsgi

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]