add script of wifif config for raspberry pi
[dotfiles.git] / bin / stopHostapd.sh
diff --git a/bin/stopHostapd.sh b/bin/stopHostapd.sh
new file mode 100755 (executable)
index 0000000..c20b12a
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash -xe
+
+# stop hostapd
+systemctl stop hostapd || true
+
+# stop dns server
+killall dnsmasq || true
+
+# stop dhcp client
+killall dhcpcd || true
+
+sleep 1
+
+# start dhcp
+dhcpcd
+
+sleep 3
+
+# scan wifi
+wpa_cli -i wlan0 scan