From db0eea2213e11f4ae1e81f57c206ea9081c14162 Mon Sep 17 00:00:00 2001 From: Alexey Avramov Date: Mon, 18 Mar 2019 19:44:54 +0900 Subject: [PATCH] fix logging --- Makefile | 3 +++ nohang | 16 ++++------------ nohang.service | 1 - 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index d69b747..d388da8 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,8 @@ install: install -m0644 ./nohang.conf $(DESTDIR)/$(PREFIX)/etc/nohang/$(VERSION) install -m0644 ./nohang.conf $(DESTDIR)/$(PREFIX)/etc/nohang/nohang.conf.default + install -d $(DESTDIR)/$(PREFIX)/var/log/nohang + install -d $(DESTDIR)/$(PREFIX)/usr/share/man/man1 gzip -k -c nohang.1 > $(DESTDIR)/$(PREFIX)/usr/share/man/man1/nohang.1.gz gzip -k -c oom-sort.1 > $(DESTDIR)/$(PREFIX)/usr/share/man/man1/oom-sort.1.gz @@ -37,6 +39,7 @@ uninstall: rm -fv $(PREFIX)/usr/share/man/man1/oom-trigger.1.gz rm -fv $(PREFIX)/lib/systemd/system/nohang.service rm -fvr $(PREFIX)/etc/nohang/ + rm -fvr $(PREFIX)/var/log/nohang/ systemd: systemctl daemon-reload diff --git a/nohang b/nohang index 6c4f6e9..b3984d9 100755 --- a/nohang +++ b/nohang @@ -14,6 +14,9 @@ from logging import basicConfig from logging import info +start_time = time() + + logfile = '/var/log/nohang/nohang.log' @@ -22,8 +25,7 @@ basicConfig(filename=logfile, format="%(asctime)s: %(message)s") -separate_log = True - +separate_log = False def log(msg): @@ -33,16 +35,6 @@ def log(msg): - - - - - - - -start_time = time() - - help_mess = """usage: nohang [-h] [-c CONFIG] optional arguments: diff --git a/nohang.service b/nohang.service index bf645fa..d3cda34 100644 --- a/nohang.service +++ b/nohang.service @@ -7,7 +7,6 @@ Documentation=man:nohang(1) https://github.com/hakavlad/nohang ExecStart=/usr/sbin/nohang --config /etc/nohang/nohang.conf Slice=nohang.slice Restart=always -ProtectSystem=strict MemoryMax=100M TasksMax=100 OOMScoreAdjust=-10