#!/bin/sh | |
if [ "$1" == "start" ]; then | |
ifconfig wlan0 up | |
if [ $? != 0 ]; then | |
exit 1 | |
fi | |
ps -eo "%p %a" | grep "dhcpcd wlan0" | grep -v grep | |
if [ $? != 0 ]; then | |
dhcpcd wlan0 -t 0 -o domain_name_servers --noipv4ll -B -G -j /tmp/dhcpcd.log & | |
fi | |
elif [ "$1" == "stop" ]; then | |
ps -eo "%p %a" | grep "dhcpcd wlan0" | grep -v grep | awk '{print "kill "$1}' | sh | |
ifconfig wlan0 0.0.0.0 | |
if [ $? != 0 ]; then | |
exit 1 | |
fi | |
else | |
exit 2 | |
fi | |
exit 0 |