you.chen | cd88268 | 2023-04-24 15:39:37 +0800 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | if [ "$1" == "start" ]; then |
| 4 | ifconfig wlan0 up |
| 5 | if [ $? != 0 ]; then |
| 6 | exit 1 |
| 7 | fi |
you.chen | 3c30900 | 2023-04-26 10:00:06 +0800 | [diff] [blame^] | 8 | ps -eo "%p %a" | grep "dhcpcd wlan0" | grep -v grep |
you.chen | cd88268 | 2023-04-24 15:39:37 +0800 | [diff] [blame] | 9 | if [ $? != 0 ]; then |
| 10 | dhcpcd wlan0 -t 0 -o domain_name_servers --noipv4ll -B -G & |
| 11 | fi |
| 12 | elif [ "$1" == "stop" ]; then |
you.chen | 3c30900 | 2023-04-26 10:00:06 +0800 | [diff] [blame^] | 13 | ps -eo "%p %a" | grep "dhcpcd wlan0" | grep -v grep | awk '{print "kill "$1}' | sh |
you.chen | cd88268 | 2023-04-24 15:39:37 +0800 | [diff] [blame] | 14 | ifconfig wlan0 0.0.0.0 |
| 15 | if [ $? != 0 ]; then |
| 16 | exit 1 |
| 17 | fi |
| 18 | else |
| 19 | exit 2 |
| 20 | fi |
| 21 | |
you.chen | 3c30900 | 2023-04-26 10:00:06 +0800 | [diff] [blame^] | 22 | exit 0 |