diff --git a/session b/session index 38f1f0e..b5c46be 100755 --- a/session +++ b/session @@ -294,11 +294,9 @@ case $mode in "terminate"|"term"|"t"|"kill"|"k") # Check if we are in terminate/kill mode if [[ ${mode::1} == "k" ]]; then - SIGNAL="-9" # SIGKILL - CLEANUP=1 # requires manual cleanup + SIGNAL="-SIGKILL" else - SIGNAL="-15" # SIGTERM - CLEANUP=0 + SIGNAL="-SIGTERM" fi # If no session name specified: terminate all sessions if [ -z "$1" ]; then @@ -317,15 +315,16 @@ case $mode in exit_if_nonexisting_session $session_name fi for sname in ${session_name[@]}; do - logpath=$(get_log_path $sname) PID=$(get_session_pid $sname) - if [ ! -z "$PID" ]; then - CMD="kill $SIGNAL $PID" - eval $CMD - else # this seems to be an orphan - CLEANUP=1 - fi - [[ "$CLEANUP" -eq 1 ]] && rm $(get_session_path $sname) + session_path=$(get_session_path $sname) + log_path=$(get_log_path $sname) + fifo_path=$(get_fifo_path $sname) + [[ -a $fifo_path ]] && echo > $fifo_path + [[ ! -z "$PID" ]] && kill $SIGNAL $PID + tail --pid=$PID -f /dev/null + [[ -a $session_path ]] && rm -f $session_path + [[ -a $fifo_path ]] && rm -f $fifo_path + [[ -f $log_path ]] && rm -f $log_path done exit $EXIT_SUCCESS ;;