fix code style, fix bug with using python 3.4
This commit is contained in:
parent
b350a95fa9
commit
337634a7cc
@ -150,7 +150,7 @@ prefer_factor = 3
|
|||||||
Badness of processes whose names correspond to avoid_regex will
|
Badness of processes whose names correspond to avoid_regex will
|
||||||
be calculated by the following formula:
|
be calculated by the following formula:
|
||||||
badness = oom_score / avoid_factor
|
badness = oom_score / avoid_factor
|
||||||
|
|
||||||
# Need more examples
|
# Need more examples
|
||||||
|
|
||||||
avoid_regex = ^(sshd|Xorg)$
|
avoid_regex = ^(sshd|Xorg)$
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
# notify_low_mem --mem '14% 12%' --name 'stress' --pid '6666'
|
# notify_low_mem --mem '14% 12%' --name 'stress' --pid '6666'
|
||||||
|
|
||||||
|
# should be remaked without run `ps`
|
||||||
|
|
||||||
# output:
|
# output:
|
||||||
# Low memory: 14% 12%
|
# Low memory: 14% 12%
|
||||||
# Fattest process: 6666, stress
|
# Fattest process: 6666, stress
|
||||||
@ -79,9 +81,15 @@ def root_notify_env():
|
|||||||
|
|
||||||
b = root_notify_env()
|
b = root_notify_env()
|
||||||
|
|
||||||
|
# if somebody logged in with GUI
|
||||||
if len(b) > 0:
|
if len(b) > 0:
|
||||||
|
|
||||||
|
# iterating over logged-in users
|
||||||
for i in b:
|
for i in b:
|
||||||
username, display_env, dbus_env = i[0], i[1], i[2]
|
username, display_env, dbus_env = i[0], i[1], i[2]
|
||||||
Popen(['sudo', '-u', username, 'env', display_env,
|
Popen(
|
||||||
dbus_env, 'notify-send', '--icon=dialog-warning',
|
['sudo', '-u', username,
|
||||||
'{}'.format(title), '{}'.format(body)])
|
'env', display_env, dbus_env,
|
||||||
|
'notify-send', '--icon=dialog-warning',
|
||||||
|
'{}'.format(title), '{}'.format(body)]
|
||||||
|
).wait(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user