From ddc8c9e59af6c599adfc1442bde7bcfb5a4feb15 Mon Sep 17 00:00:00 2001 From: Alexey Avramov Date: Sun, 5 Aug 2018 12:31:45 +0900 Subject: [PATCH] fix GUI notifications --- nohang | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/nohang b/nohang index b354fca..2141548 100755 --- a/nohang +++ b/nohang @@ -13,6 +13,10 @@ from sys import stdout sig_dict = {signal.SIGKILL: 'SIGKILL', signal.SIGTERM: 'SIGTERM'} +notify_sig_dict = {signal.SIGKILL: 'Killing', + signal.SIGTERM: 'Terminating'} + + # directory where the script is running cd = os.getcwd() @@ -232,10 +236,8 @@ def send_notify_warn(): def send_notify(signal, name, pid, oom_score, vm_rss, vm_swap): title = 'NOHANG TRIGGERED' - body = 'Nohang sent {} \nto the process {} \nP' \ - 'id: {} \nBadness: {} \nVmRSS: {} MiB \nVmSwap: {} MiB'.format( - sig_dict[signal], name, pid, oom_score, vm_rss, vm_swap) + body = '{} process {}, {}'.format( + notify_sig_dict[signal], pid, name) if root: # отправляем уведомление всем залогиненным пользователям b = root_notify_env() @@ -1458,4 +1460,3 @@ while True: else: stdout.flush() sleep_after_check_mem() -