fix new conf

This commit is contained in:
Alexey Avramov 2019-01-14 06:12:27 +09:00
parent 1e91e6b0da
commit 16eab59cc1
2 changed files with 6 additions and 4 deletions

8
nohang
View File

@ -768,7 +768,7 @@ def find_victim_and_send_signal(signal):
command = etc_dict[name] command = etc_dict[name]
if stop_cont: if stop_cont:
os.kill(int(pid), SIGCONT) os.kill(int(pid), SIGCONT)
exit_status = os.system(etc_dict[name].replace('$PID', pid)) exit_status = os.system(etc_dict[name].replace('$PID', pid)).replace('$NAME', pid_to_name(pid)))
if exit_status == 0: if exit_status == 0:
exit_status = '\033[32m0\033[0m' exit_status = '\033[32m0\033[0m'
else: else:
@ -779,11 +779,11 @@ def find_victim_and_send_signal(signal):
etc_info = '{}' \ etc_info = '{}' \
'\n\033[4mImplement corrective action:\033[0m\n Execute the command: \033[4m{}\033[0m' \ '\n\033[4mImplement corrective action:\033[0m\n Execute the command: \033[4m{}\033[0m' \
'\n Exit status: {}; response time: {} ms'.format( '\n Exit status: {}; response time: {} ms'.format(
victim_info, command.replace('$PID', pid), exit_status, victim_info, command.replace('$PID', pid).replace('$NAME', pid_to_name(pid)), exit_status,
round(response_time * 1000)) round(response_time * 1000))
# update stat_dict # update stat_dict
key = "Run the command '\033[35m{}\033[0m'".format(command.replace('$PID', pid)) key = "Run the command '\033[35m{}\033[0m'".format(command.replace('$PID', pid).replace('$NAME', pid_to_name(pid)))
print(key) print(key)
update_stat_dict_and_print(key) update_stat_dict_and_print(key)
@ -791,7 +791,7 @@ def find_victim_and_send_signal(signal):
print(etc_info) print(etc_info)
if gui_notifications: if gui_notifications:
send_notify_etc(pid, name, command.replace('$PID', pid)) send_notify_etc(pid, name, command.replace('$PID', pid).replace('$NAME', pid_to_name(pid)))
else: else:

View File

@ -238,6 +238,8 @@ execute_the_command = False
It is way to send any signal instead of SIGTERM. It is way to send any signal instead of SIGTERM.
(run `kill -L` to see list of all signals) (run `kill -L` to see list of all signals)
Also $NAME will be replaced by process name.
$ETC bash /// kill -9 $PID $ETC bash /// kill -9 $PID
$ETC firefox-esr /// kill -SEGV $PID $ETC firefox-esr /// kill -SEGV $PID