tunnelier tidying

This commit is contained in:
q
2017-08-20 00:06:24 +03:00
parent a288287aaf
commit d70d240cf5

View File

@@ -72,7 +72,7 @@ function list_all_ssh() {
read -t 600 inputpid
[[ "$inputpid" =~ $number_re ]] && {
kill $inputpid
ask_to_kill $inputpid
}
}
@@ -99,6 +99,13 @@ function run_command() {
eval $( get_command "$1" )
}
function ask_to_kill() {
printf "${colRow}\nPID: $1\n k kill\n t terminate${colZ}\n"
read -t 600 input2
[[ "$input2" = "k" ]] && kill $1
[[ "$input2" = "t" ]] && kill -9 $1
}
[[ -n "$2" ]] && {
run_args "$@"
@@ -131,10 +138,7 @@ while true; do
this_pid="$( get_pid "${ids[$j]}" )"
[[ -n "$this_pid" ]] && {
# PID exists, ask to kill
printf "\n ${colRow}k kill\n t terminate${colZ}\n"
read -t 600 input2
[[ "$input2" = "k" ]] && kill $( get_pid "${ids[$j]}" )
[[ "$input2" = "t" ]] && kill -9 $( get_pid "${ids[$j]}" )
ask_to_kill "$this_pid"
}
[[ -z "$this_pid" ]] && {
# PID empty, run