[packages/linux-pstore] - 0.2; report hostname and uptime

arekm arekm at pld-linux.org
Fri Feb 22 06:58:02 CET 2019


commit 4729278e82826e7a1d27bf14569b44adc609982c
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Fri Feb 22 06:57:53 2019 +0100

    - 0.2; report hostname and uptime

 linux-pstore.py   | 13 ++++++++++++-
 linux-pstore.spec |  3 ++-
 2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/linux-pstore.spec b/linux-pstore.spec
index a3a9cfe..5fb959b 100644
--- a/linux-pstore.spec
+++ b/linux-pstore.spec
@@ -1,6 +1,6 @@
 Summary:	Save pstore logs and make room for future logs
 Name:		linux-pstore
-Version:	0.1
+Version:	0.2
 Release:	1
 License:	GPL
 Group:		Daemons
@@ -11,6 +11,7 @@ BuildRequires:	rpmbuild(macros) >= 1.268
 Requires:	crondaemon
 Requires:	python3
 Requires:	python3-modules
+Requires:	python3-psutil
 BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
diff --git a/linux-pstore.py b/linux-pstore.py
index a215d0a..ee8a647 100755
--- a/linux-pstore.py
+++ b/linux-pstore.py
@@ -4,7 +4,15 @@
 import datetime
 import os
 import re
+import socket
 import shutil
+import time
+
+uptime = True
+try:
+    import psutil
+except ModuleNotFoundError as e:
+    uptime = False
 
 pstoredir = '/sys/fs/pstore'
 archivedir = '/var/log/pstore'
@@ -19,7 +27,10 @@ files = sorted(os.listdir(pstoredir))
 if len(files) and not os.path.isdir(tdir):
     os.mkdir(tdir)
 
-msg = "Found %d files in pstore fs directory: \n\n" % len(files)
+msg =  "Hostname:           %s\n" % socket.getfqdn()
+if uptime:
+    msg += "Uptime:             %s\n" % str(datetime.timedelta(seconds=time.time()-psutil.boot_time()))
+msg += "Files in pstore:    %d\n" % len(files)
 
 for file in files:
     fpath = os.path.join(pstoredir, file)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/linux-pstore.git/commitdiff/4729278e82826e7a1d27bf14569b44adc609982c



More information about the pld-cvs-commit mailing list