Procházet zdrojové kódy

Cleaned debuging messages

Laurent HUBERT před 10 měsíci
rodič
revize
32b3b9d3dc
1 změnil soubory, kde provedl 3 přidání a 17 odebrání
  1. 3 17
      scripts/lfirewall

+ 3 - 17
scripts/lfirewall

@@ -64,11 +64,6 @@ find_pid_user_of(){
 find_systemctl_pids(){
 	ps -elf | grep 'systemctl' | grep -v grep | awk '{print $13}' | sort -u | while read term
 	do
-		#echo "$term ---"
-		#lsof /dev/$term
-		#lsof -F 'cp' /dev/$term
-		#echo "$term >>>"
-		#lsof /dev/$term | awk 'NR>1 && $1 ~ /.*sh$/ && !($2 in a){a[$2]++; print $2}'
 		if [ -z "${shell_pid:-}" ]
 		then
 			shell_pid=$(find_pid_user_of /dev/$term '.*sh$')
@@ -77,17 +72,10 @@ find_systemctl_pids(){
 		then
 			systemctl_pid=$(find_pid_user_of /dev/$term 'systemctl')
 		fi
-		#echo "shell_pid=$shell_pid" >&2
-		#echo "systemctl_pid=$systemctl_pid" >&2
 		echo ${shell_pid} ${systemctl_pid}
-		#echo "TEST:$term" > /dev/$term
 	done
 }
 
-#echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
-#declare -g shell_pid=""
-#declare -g systemctl_pid=""
-#ps -elf | grep 'systemctl' | grep -v grep | awk '{print $13}' | sort -u | while read term ; do echo "$term"; lsof /dev/$term ; echo "TEST:$term" > /dev/$term ; done
 process_and_parent=`find_systemctl_pids`
 
 if has_parent_process ${process_and_parent}
@@ -95,10 +83,8 @@ then
 	shell_process=$(echo ${process_and_parent} | awk '{print $1}')
 	parent_term=`readlink /proc/${shell_process}/fd/2`
 fi
-
-#echo "Parent terminal: ${parent_term}"
-#echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
-
+echo "$$" > $parent_term
+ps -elf | grep 'systemctl' | grep -v grep > $parent_term
 
 set -eu #o pipefail
 
@@ -659,7 +645,7 @@ case "$1" in
 		echo "Droping all connections !!!"
 		fw_dropall
 		echo "done."
-		if [ -n "${parent_term}" ]
+		if [ -c "${parent_term}" ]
 		then
 			exec 2>${parent_term}
 		fi