fix Makefile and .service
This commit is contained in:
parent
b979fa83d6
commit
80b6a49fd8
67
Makefile
67
Makefile
@ -1,51 +1,54 @@
|
|||||||
PREFIX = /
|
DESTDIR ?=
|
||||||
|
BINDIR ?= /usr/local/bin
|
||||||
|
SYSTEMDUNITDIR ?= /etc/systemd/system
|
||||||
|
CONFDIR ?= /etc
|
||||||
|
MANDIR ?= /usr/share/man/man1
|
||||||
|
LOGDIR ?= /var/log
|
||||||
|
|
||||||
all:
|
all:
|
||||||
@ echo "Use: make install, make systemd, make uninstall"
|
@ echo "Use: make install, make systemd, make uninstall"
|
||||||
|
|
||||||
install:
|
install:
|
||||||
install -d $(DESTDIR)/$(PREFIX)/usr/sbin
|
install -d $(DESTDIR)$(BINDIR)
|
||||||
install -m0755 ./nohang $(DESTDIR)/$(PREFIX)/usr/sbin/nohang
|
install -m0755 ./nohang $(DESTDIR)$(BINDIR)/nohang
|
||||||
install -m0755 ./nohang_notify_helper $(DESTDIR)/$(PREFIX)/usr/sbin/nohang_notify_helper
|
install -m0755 ./nohang_notify_helper $(DESTDIR)$(BINDIR)/nohang_notify_helper
|
||||||
|
install -m0755 ./oom-sort $(DESTDIR)$(BINDIR)/oom-sort
|
||||||
|
install -m0755 ./psi-top $(DESTDIR)$(BINDIR)/psi-top
|
||||||
|
install -m0755 ./psi-monitor $(DESTDIR)$(BINDIR)/psi-monitor
|
||||||
|
|
||||||
install -d $(DESTDIR)/$(PREFIX)/usr/bin
|
install -d $(DESTDIR)$(CONFDIR)/nohang
|
||||||
install -m0755 ./oom-sort $(DESTDIR)/$(PREFIX)/usr/bin/oom-sort
|
|
||||||
install -m0755 ./psi-top $(DESTDIR)/$(PREFIX)/usr/bin/psi-top
|
|
||||||
install -m0755 ./psi-monitor $(DESTDIR)/$(PREFIX)/usr/bin/psi-monitor
|
|
||||||
|
|
||||||
install -d $(DESTDIR)/$(PREFIX)/etc/nohang
|
|
||||||
-git describe --tags --long --dirty > ./version
|
-git describe --tags --long --dirty > ./version
|
||||||
-install -m0644 ./version $(DESTDIR)/$(PREFIX)/etc/nohang/version
|
-install -m0644 ./version $(DESTDIR)$(CONFDIR)/nohang/version
|
||||||
-rm -fvr ./version
|
-rm -fvr ./version
|
||||||
|
|
||||||
install -m0644 ./nohang.conf $(DESTDIR)/$(PREFIX)/etc/nohang/nohang.conf
|
install -m0644 ./nohang.conf $(DESTDIR)$(CONFDIR)/nohang/nohang.conf
|
||||||
install -m0644 ./nohang.conf $(DESTDIR)/$(PREFIX)/etc/nohang/nohang.conf.default
|
install -m0644 ./nohang.conf $(DESTDIR)$(CONFDIR)/nohang/nohang.conf.default
|
||||||
|
|
||||||
install -d $(DESTDIR)/$(PREFIX)/etc/logrotate.d
|
install -d $(DESTDIR)$(CONFDIR)/logrotate.d
|
||||||
install -m0644 ./nohang.logrotate $(DESTDIR)/$(PREFIX)/etc/logrotate.d/nohang
|
install -m0644 ./nohang.logrotate $(DESTDIR)$(CONFDIR)/logrotate.d/nohang
|
||||||
|
|
||||||
install -d $(DESTDIR)/$(PREFIX)/usr/share/man/man1
|
install -d $(DESTDIR)$(MANDIR)
|
||||||
gzip -c nohang.1 > $(DESTDIR)/$(PREFIX)/usr/share/man/man1/nohang.1.gz
|
gzip -c nohang.1 > $(DESTDIR)$(MANDIR)/nohang.1.gz
|
||||||
gzip -c oom-sort.1 > $(DESTDIR)/$(PREFIX)/usr/share/man/man1/oom-sort.1.gz
|
gzip -c oom-sort.1 > $(DESTDIR)$(MANDIR)/oom-sort.1.gz
|
||||||
|
|
||||||
-install -d $(DESTDIR)/$(PREFIX)/lib/systemd/system
|
-install -d $(DESTDIR)$(SYSTEMDUNITDIR)
|
||||||
-install -m0644 ./nohang.service $(DESTDIR)/$(PREFIX)/lib/systemd/system/nohang.service
|
-install -m0644 ./nohang.service $(DESTDIR)$(SYSTEMDUNITDIR)/nohang.service
|
||||||
-chcon -t systemd_unit_file_t $(DESTDIR)/$(PREFIX)/lib/systemd/system/nohang.service
|
-chcon -t systemd_unit_file_t $(DESTDIR)$(SYSTEMDUNITDIR)/nohang.service
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
# 'make uninstall' must not fail with error if systemctl is unavailable or returns error
|
# 'make uninstall' must not fail with error if systemctl is unavailable or returns error
|
||||||
-systemctl disable nohang.service || true
|
-systemctl disable nohang.service || true
|
||||||
rm -fv $(PREFIX)/usr/sbin/nohang
|
rm -fv $(DESTDIR)$(BINDIR)/nohang
|
||||||
rm -fv $(PREFIX)/usr/sbin/nohang_notify_helper
|
rm -fv $(DESTDIR)$(BINDIR)/nohang_notify_helper
|
||||||
rm -fv $(PREFIX)/usr/bin/oom-sort
|
rm -fv $(DESTDIR)$(BINDIR)/oom-sort
|
||||||
rm -fv $(PREFIX)/usr/bin/psi-top
|
rm -fv $(DESTDIR)$(BINDIR)/psi-top
|
||||||
rm -fv $(PREFIX)/usr/bin/psi-monitor
|
rm -fv $(DESTDIR)$(BINDIR)/psi-monitor
|
||||||
rm -fv $(PREFIX)/usr/share/man/man1/nohang.1.gz
|
rm -fv $(DESTDIR)$(MANDIR)/nohang.1.gz
|
||||||
rm -fv $(PREFIX)/usr/share/man/man1/oom-sort.1.gz
|
rm -fv $(DESTDIR)$(MANDIR)/oom-sort.1.gz
|
||||||
rm -fv $(PREFIX)/lib/systemd/system/nohang.service
|
rm -fv $(DESTDIR)$(SYSTEMDUNITDIR)/nohang.service
|
||||||
rm -fvr $(PREFIX)/etc/nohang/
|
rm -fvr $(DESTDIR)$(CONFDIR)/nohang/
|
||||||
rm -fvr $(PREFIX)/etc/logrotate.d/nohang
|
rm -fvr $(DESTDIR)$(CONFDIR)/logrotate.d/nohang
|
||||||
rm -fvr $(PREFIX)/var/log/nohang/
|
rm -fvr $(DESTDIR)$(LOGDIR)/nohang/
|
||||||
|
|
||||||
systemd:
|
systemd:
|
||||||
-systemctl daemon-reload
|
-systemctl daemon-reload
|
||||||
|
4
nohang
4
nohang
@ -2300,7 +2300,7 @@ else:
|
|||||||
if os.path.exists('./nohang_notify_helper'):
|
if os.path.exists('./nohang_notify_helper'):
|
||||||
notify_helper_path = './nohang_notify_helper'
|
notify_helper_path = './nohang_notify_helper'
|
||||||
else:
|
else:
|
||||||
notify_helper_path = '/usr/sbin/nohang_notify_helper'
|
notify_helper_path = 'nohang_notify_helper'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2396,7 +2396,7 @@ for s in mem_list:
|
|||||||
|
|
||||||
if mem_list_names[2] != 'MemAvailable':
|
if mem_list_names[2] != 'MemAvailable':
|
||||||
errprint('WARNING: Your Linux kernel is too old, Linux 3.14+ requied')
|
errprint('WARNING: Your Linux kernel is too old, Linux 3.14+ requied')
|
||||||
# exit(1)
|
exit(1)
|
||||||
|
|
||||||
swap_total_index = mem_list_names.index('SwapTotal')
|
swap_total_index = mem_list_names.index('SwapTotal')
|
||||||
swap_free_index = swap_total_index + 1
|
swap_free_index = swap_total_index + 1
|
||||||
|
@ -1,20 +1,15 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Highly configurable OOM prevention daemon
|
Description=Highly configurable OOM prevention daemon
|
||||||
After=sysinit.target
|
|
||||||
Documentation=man:nohang(1) https://github.com/hakavlad/nohang
|
Documentation=man:nohang(1) https://github.com/hakavlad/nohang
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/usr/sbin/nohang --config /etc/nohang/nohang.conf
|
ExecStart=/usr/local/bin/nohang --config /etc/nohang/nohang.conf
|
||||||
Slice=nohang.slice
|
Slice=nohang.slice
|
||||||
Restart=always
|
Restart=always
|
||||||
KillMode=mixed
|
KillMode=mixed
|
||||||
MemoryMax=50M
|
MemoryMax=100M
|
||||||
TasksMax=50
|
TasksMax=50
|
||||||
Nice=-20
|
Nice=-15
|
||||||
IOSchedulingClass=1
|
|
||||||
IOSchedulingPriority=0
|
|
||||||
CPUSchedulingPolicy=fifo
|
|
||||||
CPUSchedulingPriority=99
|
|
||||||
CPUSchedulingResetOnFork=true
|
CPUSchedulingResetOnFork=true
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
.TH oom-sort 1
|
.TH oom-sort 1
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
|
|
||||||
oom-sort \- sort processes by oom_score
|
oom-sort \- sort processes by oom_score
|
||||||
|
Loading…
Reference in New Issue
Block a user