From cb1919c15e887e5b06ccc7220df04509a5fdd546 Mon Sep 17 00:00:00 2001 From: Tyler Bean Date: Fri, 2 Nov 2018 11:48:16 -0500 Subject: [PATCH] fix check logic --- wirelesslogin/wireless_upkeep.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/wirelesslogin/wireless_upkeep.sh b/wirelesslogin/wireless_upkeep.sh index 923e005..be26af3 100755 --- a/wirelesslogin/wireless_upkeep.sh +++ b/wirelesslogin/wireless_upkeep.sh @@ -32,11 +32,8 @@ function bring_it_down { } function bring_it_up { - MY_PATH="`dirname \"$0\"`" - MY_PATH="`( cd \"$MY_PATH\" && pwd )`" - passwrd_file=$MY_PATH/passwd UUID=$(nmcli -f NAME,UUID c | sift '@Wireless' | awk '{print $2}') - nmcli c up $UUID passwd-file $passwrd_file + nmcli c up $UUID passwd-file /home/tyler/shellscripts/wirelesslogin/passwd-file } function spoofy_doof { @@ -54,7 +51,6 @@ function reboot_router { } function fixit { - if [[ $(am_i_connected) != true ]]; then if [[ $(am_i_connected_to_something) == true ]]; then bring_it_down @@ -76,4 +72,9 @@ function fixit { done } -pingcheck +if [[ $(am_i_connected) == true ]]; then + pingcheck +else + bring_it_up + pingcheck +fi