update readme
This commit is contained in:
parent
778561793c
commit
03a886e685
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
Nohang is a highly configurable daemon for Linux which is able to correctly prevent [out of memory](https://en.wikipedia.org/wiki/Out_of_memory) (OOM) and keep system responsiveness in low memory conditions.
|
Nohang is a highly configurable daemon for Linux which is able to correctly prevent [out of memory](https://en.wikipedia.org/wiki/Out_of_memory) (OOM) and keep system responsiveness in low memory conditions.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## What is the problem?
|
## What is the problem?
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ from argparse import ArgumentParser
|
|||||||
from os import listdir
|
from os import listdir
|
||||||
from subprocess import Popen, TimeoutExpired
|
from subprocess import Popen, TimeoutExpired
|
||||||
|
|
||||||
wait_time = 2
|
wait_time = 10
|
||||||
|
|
||||||
parser = ArgumentParser()
|
parser = ArgumentParser()
|
||||||
|
|
||||||
@ -145,14 +145,18 @@ if len(b) > 0:
|
|||||||
dbus_tuple = dbus_env.partition('=')
|
dbus_tuple = dbus_env.partition('=')
|
||||||
display_key, display_value = display_tuple[0], display_tuple[2]
|
display_key, display_value = display_tuple[0], display_tuple[2]
|
||||||
dbus_key, dbus_value = dbus_tuple[0], dbus_tuple[2]
|
dbus_key, dbus_value = dbus_tuple[0], dbus_tuple[2]
|
||||||
try:
|
|
||||||
Popen(['sudo', '-u', username,
|
with Popen(['sudo', '-u', username,
|
||||||
'notify-send', '--icon=dialog-warning',
|
'notify-send', '--icon=dialog-warning',
|
||||||
'{}'.format(title), '{}'.format(body)
|
'{}'.format(title), '{}'.format(body)
|
||||||
], env={
|
], env={
|
||||||
display_key: display_value, dbus_key: dbus_value
|
display_key: display_value,
|
||||||
}).wait(wait_time)
|
dbus_key: dbus_value
|
||||||
|
}) as proc:
|
||||||
|
try:
|
||||||
|
proc.wait(timeout=wait_time)
|
||||||
except TimeoutExpired:
|
except TimeoutExpired:
|
||||||
print('TimeoutExpired: notify ' + username)
|
proc.kill()
|
||||||
|
print('TimeoutExpired: notify' + username)
|
||||||
else:
|
else:
|
||||||
print('Low memory warnings: nobody logged in with GUI. Nothing to do.')
|
print('Low memory warnings: nobody logged in with GUI. Nothing to do.')
|
||||||
|
Loading…
Reference in New Issue
Block a user