1
0
mirror of https://github.com/byReqz/conn.git synced 2024-11-22 00:53:14 +00:00

tweaked -w and -ww

This commit is contained in:
Nils 2021-02-09 13:31:03 +00:00 committed by GitHub
parent f991f4f352
commit 6fd943cb91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

12
conn.sh
View File

@ -194,11 +194,17 @@ fi
fping=$(fping -a $2) fping=$(fping -a $2)
p135=$(nping -q1 -c1 -p135 $2) p135=$(nping -q1 -c1 -p135 $2)
p3389=$(nping -q1 -c1 -p3389 $2) p3389=$(nping -q1 -c1 -p3389 $2)
if [[ $fping != "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping != "$2" ]] && [[ -n $(echo $p3389 | grep "Successful connections: 1") ]] || [[ $fping = "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]];then if [[ $fping != "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]] || [[ $fping != "$2" ]] && [[ -n $(echo $p3389 | grep "Successful connections: 1") ]];then
echo "-------------------Availability----------------------" echo "-------------------Availability----------------------"
echo "note: this seems to be a windows machine which does not respond to ICMP" echo "note: this seems to be a windows machine which does not respond to ICMP"
notify-send "$2 is now reachable" "and seems to be a windows machine" -u normal -t 30000 -a conn notify-send "$2 is now reachable" "and seems to be a windows machine" -u normal -t 30000 -a conn
echo "-----------------------------------------------------" echo "-----------------------------------------------------"
elif [[ $fping = "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]];then
echo "-------------------Availability----------------------"
echo "note: this seems to be a windows machine which does respond to ICMP"
fping -e $2
notify-send "$2 is now reachable" "and seems to be a windows machine" -u normal -t 30000 -a conn
echo "-----------------------------------------------------"
else else
while [[ "$(fping -m -q -u $2)" == "$2" ]]; do : while [[ "$(fping -m -q -u $2)" == "$2" ]]; do :
done done
@ -235,13 +241,13 @@ fi
fping=$(fping -a $2) fping=$(fping -a $2)
p135=$(nping -q1 -c1 -p135 $2) p135=$(nping -q1 -c1 -p135 $2)
p3389=$(nping -q1 -c1 -p3389 $2) p3389=$(nping -q1 -c1 -p3389 $2)
if [[ $fping = "$2" ]];then if [[ $fping = "$2" ]] && [[ -n $(echo $p135 | grep "Successful connections: 1") ]];then
echo "-------------------Availability----------------------" echo "-------------------Availability----------------------"
echo "note: this seems to be a unix machine which does respond to ICMP" echo "note: this seems to be a unix machine which does respond to ICMP"
notify-send "$2 is a unix machine" -u normal -t 30000 -a conn notify-send "$2 is a unix machine" -u normal -t 30000 -a conn
echo "-----------------------------------------------------" echo "-----------------------------------------------------"
else else
while [[ -n $(nping -q1 -c1 -p135 $2 | grep "Successful connections: 1") ]]; do : while [[ -z $(nping -q1 -c1 -p135 $2 | grep "Successful connections: 1") ]]; do :
done done
echo "-------------------Availability----------------------" echo "-------------------Availability----------------------"
rescue=$(nping -q1 -c1 -p22,222 $2) rescue=$(nping -q1 -c1 -p22,222 $2)