Skip to content

Commit 48c9218

Browse files
committed
improved funciton test_availability
1 parent 3605356 commit 48c9218

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

4nonimizer

+1-8
Original file line numberDiff line numberDiff line change
@@ -550,20 +550,13 @@ function test_availability ()
550550
fi
551551
cd /opt/4nonimizer/vpn/$lista
552552
dos2unix * &> /dev/null
553-
for file in $(ls *.ovpn)
553+
for file in $(ls *.ovpn 2> /dev/null)
554554
do
555555
checkedprotocol=$(grep -v '#' $file | grep -m 1 proto | awk '{print $2}')
556556
checkedip=$(grep -v '#' $file | grep -m 1 remote | awk '{print $2}')
557557
checkedport=$(grep -v '#' $file | grep -m 1 remote | awk '{print $3}')
558558
if [[ $checkedprotocol = *"tcp"* ]]
559559
then
560-
#option 1
561-
#result=$(nc -zv -w3 $checkedip $checkedport 2>&1 | grep succeeded);
562-
#if [ -n "$result" ]; then
563-
#option 2
564-
#</dev/tcp/$checkedip/$checkedport
565-
#if [ "$?" -ne 0 ]; then
566-
#option 3
567560
open=`nmap --version-light --min-rate 10000 -p $checkedport $checkedip | grep "$checkedport" | grep open`
568561
if [ -z "$open" ]; then
569562
echo "OK! The peer $checkedip in port $checkedport/$checkedprotocol is NOT available. The $file will be deleted."

0 commit comments

Comments
 (0)