remove wait(), fix makefile

This commit is contained in:
Alexey Avramov 2018-12-08 00:20:21 +09:00
parent 591f9e07a7
commit d4bfe47bf8
3 changed files with 13 additions and 6 deletions

View File

@ -8,8 +8,8 @@ install:
install -d $(DESTDIR)/$(PREFIX)/usr/sbin
install -m0755 ./nohang $(DESTDIR)/$(PREFIX)/usr/sbin/nohang
install -d $(DESTDIR)/$(PREFIX)/usr/sbin
install -m0755 ./nohang_notify_low_mem $(DESTDIR)/$(PREFIX)/usr/sbin/nohang_notify_low_mem
install -d $(DESTDIR)/$(PREFIX)/usr/bin
install -m0755 ./nohang_notify_low_mem $(DESTDIR)/$(PREFIX)/usr/bin/nohang_notify_low_mem
install -d $(DESTDIR)/$(PREFIX)/usr/bin
install -m0755 ./oom-sort $(DESTDIR)/$(PREFIX)/usr/bin/oom-sort
@ -31,8 +31,9 @@ uninstall:
# 'make uninstall' must not fail with error if systemctl is unavailable or returns error
systemctl disable nohang.service || true
rm -fv $(PREFIX)/usr/sbin/nohang
rm -fv $(PREFIX)/usr/sbin/nohang_notify_low_mem
rm -fv $(PREFIX)/usr/bin/nohang_notify_low_mem
rm -fv $(PREFIX)/usr/bin/oom-sort
rm -fv $(PREFIX)/usr/bin/oom-trigger
rm -fv $(PREFIX)/usr/share/man/man1/nohang.1.gz
rm -fv $(PREFIX)/usr/share/man/man1/oom-sort.1.gz
rm -fv $(PREFIX)/usr/share/man/man1/oom-trigger.1.gz

10
nohang
View File

@ -259,8 +259,12 @@ def send_notify_warn():
if root: # If nohang was started by root
# send notification to all active users with special script
Popen(['/usr/sbin/nohang_notify_low_mem', '--mem', low_mem_percent,
'--pid', pid, '--name', name])
Popen([
'/usr/bin/nohang_notify_low_mem',
'--mem', low_mem_percent,
'--pid', pid,
'--name', name
])
else: # Or by regular user
# send notification to user that runs this nohang
Popen(['notify-send', '--icon=dialog-warning', '{}'.format(title), '{}'.format(body)])
@ -687,6 +691,8 @@ uid_index = status_names.index('Uid')
# directory where the script is running
cd = os.getcwd()
print('CD:', cd)
# where to look for a config if not specified via the -c/--config option
default_configs = (cd + '/nohang.conf', '/etc/nohang/nohang.conf')

View File

@ -92,4 +92,4 @@ if len(b) > 0:
'env', display_env, dbus_env,
'notify-send', '--icon=dialog-warning',
'{}'.format(title), '{}'.format(body)]
).wait(1)
)