wifi auto reconnection
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
1
down vote
favorite
usually wifi reconnects after dropping,but sometimes it will show the wifi log in screen already filled in,waiting to press on connect after that a new connection will form with #2 after the duplicate ssid.
sometimes i just untick/tick the 'enable networking'.other times,it wont reconnect.
i tried to form a script,but it continues to accumulate & count even when there is no badpings before reaching the max limit of 30 counts.
while true;
do
if ! [ "$(ping -c 1 google.com)" ]; then
echo "no ping,will reset"
#counter of bad pings here
count=1
while [ $count -lt 30 ]
do
count=`expr $count + 1`
echo "$count"
# insert here: retest for good ping
sleep 1
done
nmcli networking off
sleep 5
nmcli networking on
#sleep for 15sec wait wifi on ssid search
secs=$((1 * 15))
while [ $secs -gt 0 ]; do
echo -ne "$secs33[0Kr"wifi reactivate in-
sleep 1
: $((secs--))
done
if ! [ "$(ping -c 1 google.com)" ]; then
echo "still offline for $count x @ $(date)"
else
count=0
#echo "reconnected at $(date)"
echo "ON"
fi
else
echo "ONLINE"
sleep 1
clear
fi
done
shell-script wifi
 |Â
show 1 more comment
up vote
1
down vote
favorite
usually wifi reconnects after dropping,but sometimes it will show the wifi log in screen already filled in,waiting to press on connect after that a new connection will form with #2 after the duplicate ssid.
sometimes i just untick/tick the 'enable networking'.other times,it wont reconnect.
i tried to form a script,but it continues to accumulate & count even when there is no badpings before reaching the max limit of 30 counts.
while true;
do
if ! [ "$(ping -c 1 google.com)" ]; then
echo "no ping,will reset"
#counter of bad pings here
count=1
while [ $count -lt 30 ]
do
count=`expr $count + 1`
echo "$count"
# insert here: retest for good ping
sleep 1
done
nmcli networking off
sleep 5
nmcli networking on
#sleep for 15sec wait wifi on ssid search
secs=$((1 * 15))
while [ $secs -gt 0 ]; do
echo -ne "$secs33[0Kr"wifi reactivate in-
sleep 1
: $((secs--))
done
if ! [ "$(ping -c 1 google.com)" ]; then
echo "still offline for $count x @ $(date)"
else
count=0
#echo "reconnected at $(date)"
echo "ON"
fi
else
echo "ONLINE"
sleep 1
clear
fi
done
shell-script wifi
Theif ! [ "$(ping -c 1 google.com)" ]; then
line is flawed. What are you trying to accomplish there? This is always going to error and therefore be true since you are negating it.
â Jesse_b
Jul 18 at 18:49
Yourwhile [ $count -lt 30 ]
does nothing except count to 30 and print the counter each time. What are you expecting it to do differently? Are you having trouble figuring out how to exit thewhile
loop? Or are you asking how to test if the ping works?
â Kevin Kruse
Jul 18 at 18:52
@KevinKruse & Jesse_b I want to exit the count to 30 if there is a sudden good ping.
â neowiz
Jul 18 at 19:19
objective: 1. the script will stay running in the background to check for wifi disconnection 2.It should count a max of 30 badpings (because sometimes its just having slow response time ) then it will reset wifi.. if there is a sudden good ping before reaching the 30max,reseting should halt and counter will go back to zero.
â neowiz
Jul 18 at 19:32
What OS? Do you know why your signal is disconnecting? Your approach seems hackish
â FreeSoftwareServers
Jul 18 at 21:53
 |Â
show 1 more comment
up vote
1
down vote
favorite
up vote
1
down vote
favorite
usually wifi reconnects after dropping,but sometimes it will show the wifi log in screen already filled in,waiting to press on connect after that a new connection will form with #2 after the duplicate ssid.
sometimes i just untick/tick the 'enable networking'.other times,it wont reconnect.
i tried to form a script,but it continues to accumulate & count even when there is no badpings before reaching the max limit of 30 counts.
while true;
do
if ! [ "$(ping -c 1 google.com)" ]; then
echo "no ping,will reset"
#counter of bad pings here
count=1
while [ $count -lt 30 ]
do
count=`expr $count + 1`
echo "$count"
# insert here: retest for good ping
sleep 1
done
nmcli networking off
sleep 5
nmcli networking on
#sleep for 15sec wait wifi on ssid search
secs=$((1 * 15))
while [ $secs -gt 0 ]; do
echo -ne "$secs33[0Kr"wifi reactivate in-
sleep 1
: $((secs--))
done
if ! [ "$(ping -c 1 google.com)" ]; then
echo "still offline for $count x @ $(date)"
else
count=0
#echo "reconnected at $(date)"
echo "ON"
fi
else
echo "ONLINE"
sleep 1
clear
fi
done
shell-script wifi
usually wifi reconnects after dropping,but sometimes it will show the wifi log in screen already filled in,waiting to press on connect after that a new connection will form with #2 after the duplicate ssid.
sometimes i just untick/tick the 'enable networking'.other times,it wont reconnect.
i tried to form a script,but it continues to accumulate & count even when there is no badpings before reaching the max limit of 30 counts.
while true;
do
if ! [ "$(ping -c 1 google.com)" ]; then
echo "no ping,will reset"
#counter of bad pings here
count=1
while [ $count -lt 30 ]
do
count=`expr $count + 1`
echo "$count"
# insert here: retest for good ping
sleep 1
done
nmcli networking off
sleep 5
nmcli networking on
#sleep for 15sec wait wifi on ssid search
secs=$((1 * 15))
while [ $secs -gt 0 ]; do
echo -ne "$secs33[0Kr"wifi reactivate in-
sleep 1
: $((secs--))
done
if ! [ "$(ping -c 1 google.com)" ]; then
echo "still offline for $count x @ $(date)"
else
count=0
#echo "reconnected at $(date)"
echo "ON"
fi
else
echo "ONLINE"
sleep 1
clear
fi
done
shell-script wifi
edited Jul 18 at 18:50
Jesse_b
10.1k22658
10.1k22658
asked Jul 18 at 18:27
neowiz
61
61
Theif ! [ "$(ping -c 1 google.com)" ]; then
line is flawed. What are you trying to accomplish there? This is always going to error and therefore be true since you are negating it.
â Jesse_b
Jul 18 at 18:49
Yourwhile [ $count -lt 30 ]
does nothing except count to 30 and print the counter each time. What are you expecting it to do differently? Are you having trouble figuring out how to exit thewhile
loop? Or are you asking how to test if the ping works?
â Kevin Kruse
Jul 18 at 18:52
@KevinKruse & Jesse_b I want to exit the count to 30 if there is a sudden good ping.
â neowiz
Jul 18 at 19:19
objective: 1. the script will stay running in the background to check for wifi disconnection 2.It should count a max of 30 badpings (because sometimes its just having slow response time ) then it will reset wifi.. if there is a sudden good ping before reaching the 30max,reseting should halt and counter will go back to zero.
â neowiz
Jul 18 at 19:32
What OS? Do you know why your signal is disconnecting? Your approach seems hackish
â FreeSoftwareServers
Jul 18 at 21:53
 |Â
show 1 more comment
Theif ! [ "$(ping -c 1 google.com)" ]; then
line is flawed. What are you trying to accomplish there? This is always going to error and therefore be true since you are negating it.
â Jesse_b
Jul 18 at 18:49
Yourwhile [ $count -lt 30 ]
does nothing except count to 30 and print the counter each time. What are you expecting it to do differently? Are you having trouble figuring out how to exit thewhile
loop? Or are you asking how to test if the ping works?
â Kevin Kruse
Jul 18 at 18:52
@KevinKruse & Jesse_b I want to exit the count to 30 if there is a sudden good ping.
â neowiz
Jul 18 at 19:19
objective: 1. the script will stay running in the background to check for wifi disconnection 2.It should count a max of 30 badpings (because sometimes its just having slow response time ) then it will reset wifi.. if there is a sudden good ping before reaching the 30max,reseting should halt and counter will go back to zero.
â neowiz
Jul 18 at 19:32
What OS? Do you know why your signal is disconnecting? Your approach seems hackish
â FreeSoftwareServers
Jul 18 at 21:53
The
if ! [ "$(ping -c 1 google.com)" ]; then
line is flawed. What are you trying to accomplish there? This is always going to error and therefore be true since you are negating it.â Jesse_b
Jul 18 at 18:49
The
if ! [ "$(ping -c 1 google.com)" ]; then
line is flawed. What are you trying to accomplish there? This is always going to error and therefore be true since you are negating it.â Jesse_b
Jul 18 at 18:49
Your
while [ $count -lt 30 ]
does nothing except count to 30 and print the counter each time. What are you expecting it to do differently? Are you having trouble figuring out how to exit the while
loop? Or are you asking how to test if the ping works?â Kevin Kruse
Jul 18 at 18:52
Your
while [ $count -lt 30 ]
does nothing except count to 30 and print the counter each time. What are you expecting it to do differently? Are you having trouble figuring out how to exit the while
loop? Or are you asking how to test if the ping works?â Kevin Kruse
Jul 18 at 18:52
@KevinKruse & Jesse_b I want to exit the count to 30 if there is a sudden good ping.
â neowiz
Jul 18 at 19:19
@KevinKruse & Jesse_b I want to exit the count to 30 if there is a sudden good ping.
â neowiz
Jul 18 at 19:19
objective: 1. the script will stay running in the background to check for wifi disconnection 2.It should count a max of 30 badpings (because sometimes its just having slow response time ) then it will reset wifi.. if there is a sudden good ping before reaching the 30max,reseting should halt and counter will go back to zero.
â neowiz
Jul 18 at 19:32
objective: 1. the script will stay running in the background to check for wifi disconnection 2.It should count a max of 30 badpings (because sometimes its just having slow response time ) then it will reset wifi.. if there is a sudden good ping before reaching the 30max,reseting should halt and counter will go back to zero.
â neowiz
Jul 18 at 19:32
What OS? Do you know why your signal is disconnecting? Your approach seems hackish
â FreeSoftwareServers
Jul 18 at 21:53
What OS? Do you know why your signal is disconnecting? Your approach seems hackish
â FreeSoftwareServers
Jul 18 at 21:53
 |Â
show 1 more comment
1 Answer
1
active
oldest
votes
up vote
1
down vote
I think this is closer to what you want but can definitely be improved further:
while :; do
if ! ping -c1 google.com >/dev/null 2>&1; then
echo "no ping,will reset"
#counter of bad pings here
count=1
while [ "$count" -lt 30 ]; do
echo "$count"
# insert here: retest for good ping
nmcli networking off
sleep 5
nmcli networking on
if ! ping -c1 google.com >/dev/null 2>&1; then
echo "still offline for $count x @ $(date)"
else
#echo "reconnected at $(date)"
echo "ON"
break
fi
((count++))
sleep 1
done
else
echo "ONLINE"
sleep 1
clear
fi
done
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
I think this is closer to what you want but can definitely be improved further:
while :; do
if ! ping -c1 google.com >/dev/null 2>&1; then
echo "no ping,will reset"
#counter of bad pings here
count=1
while [ "$count" -lt 30 ]; do
echo "$count"
# insert here: retest for good ping
nmcli networking off
sleep 5
nmcli networking on
if ! ping -c1 google.com >/dev/null 2>&1; then
echo "still offline for $count x @ $(date)"
else
#echo "reconnected at $(date)"
echo "ON"
break
fi
((count++))
sleep 1
done
else
echo "ONLINE"
sleep 1
clear
fi
done
add a comment |Â
up vote
1
down vote
I think this is closer to what you want but can definitely be improved further:
while :; do
if ! ping -c1 google.com >/dev/null 2>&1; then
echo "no ping,will reset"
#counter of bad pings here
count=1
while [ "$count" -lt 30 ]; do
echo "$count"
# insert here: retest for good ping
nmcli networking off
sleep 5
nmcli networking on
if ! ping -c1 google.com >/dev/null 2>&1; then
echo "still offline for $count x @ $(date)"
else
#echo "reconnected at $(date)"
echo "ON"
break
fi
((count++))
sleep 1
done
else
echo "ONLINE"
sleep 1
clear
fi
done
add a comment |Â
up vote
1
down vote
up vote
1
down vote
I think this is closer to what you want but can definitely be improved further:
while :; do
if ! ping -c1 google.com >/dev/null 2>&1; then
echo "no ping,will reset"
#counter of bad pings here
count=1
while [ "$count" -lt 30 ]; do
echo "$count"
# insert here: retest for good ping
nmcli networking off
sleep 5
nmcli networking on
if ! ping -c1 google.com >/dev/null 2>&1; then
echo "still offline for $count x @ $(date)"
else
#echo "reconnected at $(date)"
echo "ON"
break
fi
((count++))
sleep 1
done
else
echo "ONLINE"
sleep 1
clear
fi
done
I think this is closer to what you want but can definitely be improved further:
while :; do
if ! ping -c1 google.com >/dev/null 2>&1; then
echo "no ping,will reset"
#counter of bad pings here
count=1
while [ "$count" -lt 30 ]; do
echo "$count"
# insert here: retest for good ping
nmcli networking off
sleep 5
nmcli networking on
if ! ping -c1 google.com >/dev/null 2>&1; then
echo "still offline for $count x @ $(date)"
else
#echo "reconnected at $(date)"
echo "ON"
break
fi
((count++))
sleep 1
done
else
echo "ONLINE"
sleep 1
clear
fi
done
edited Jul 18 at 19:25
answered Jul 18 at 19:01
Jesse_b
10.1k22658
10.1k22658
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f457067%2fwifi-auto-reconnection%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
The
if ! [ "$(ping -c 1 google.com)" ]; then
line is flawed. What are you trying to accomplish there? This is always going to error and therefore be true since you are negating it.â Jesse_b
Jul 18 at 18:49
Your
while [ $count -lt 30 ]
does nothing except count to 30 and print the counter each time. What are you expecting it to do differently? Are you having trouble figuring out how to exit thewhile
loop? Or are you asking how to test if the ping works?â Kevin Kruse
Jul 18 at 18:52
@KevinKruse & Jesse_b I want to exit the count to 30 if there is a sudden good ping.
â neowiz
Jul 18 at 19:19
objective: 1. the script will stay running in the background to check for wifi disconnection 2.It should count a max of 30 badpings (because sometimes its just having slow response time ) then it will reset wifi.. if there is a sudden good ping before reaching the 30max,reseting should halt and counter will go back to zero.
â neowiz
Jul 18 at 19:32
What OS? Do you know why your signal is disconnecting? Your approach seems hackish
â FreeSoftwareServers
Jul 18 at 21:53