fix logging

This commit is contained in:
Alexey Avramov 2019-03-18 19:44:54 +09:00
parent 3fc75353c4
commit db0eea2213
3 changed files with 7 additions and 13 deletions

View File

@ -17,6 +17,8 @@ install:
install -m0644 ./nohang.conf $(DESTDIR)/$(PREFIX)/etc/nohang/$(VERSION) install -m0644 ./nohang.conf $(DESTDIR)/$(PREFIX)/etc/nohang/$(VERSION)
install -m0644 ./nohang.conf $(DESTDIR)/$(PREFIX)/etc/nohang/nohang.conf.default 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 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 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 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)/usr/share/man/man1/oom-trigger.1.gz
rm -fv $(PREFIX)/lib/systemd/system/nohang.service rm -fv $(PREFIX)/lib/systemd/system/nohang.service
rm -fvr $(PREFIX)/etc/nohang/ rm -fvr $(PREFIX)/etc/nohang/
rm -fvr $(PREFIX)/var/log/nohang/
systemd: systemd:
systemctl daemon-reload systemctl daemon-reload

16
nohang
View File

@ -14,6 +14,9 @@ from logging import basicConfig
from logging import info from logging import info
start_time = time()
logfile = '/var/log/nohang/nohang.log' logfile = '/var/log/nohang/nohang.log'
@ -22,8 +25,7 @@ basicConfig(filename=logfile,
format="%(asctime)s: %(message)s") format="%(asctime)s: %(message)s")
separate_log = True separate_log = False
def log(msg): def log(msg):
@ -33,16 +35,6 @@ def log(msg):
start_time = time()
help_mess = """usage: nohang [-h] [-c CONFIG] help_mess = """usage: nohang [-h] [-c CONFIG]
optional arguments: optional arguments:

View File

@ -7,7 +7,6 @@ Documentation=man:nohang(1) https://github.com/hakavlad/nohang
ExecStart=/usr/sbin/nohang --config /etc/nohang/nohang.conf ExecStart=/usr/sbin/nohang --config /etc/nohang/nohang.conf
Slice=nohang.slice Slice=nohang.slice
Restart=always Restart=always
ProtectSystem=strict
MemoryMax=100M MemoryMax=100M
TasksMax=100 TasksMax=100
OOMScoreAdjust=-10 OOMScoreAdjust=-10