b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | #!/bin/sh /etc/rc.common |
| 2 | |
| 3 | START=60 |
| 4 | |
| 5 | lease_file=/var/dhclient.leases |
| 6 | config_file=/etc/dhclient.conf |
| 7 | pid_file=/var/run/dhclient.pid |
| 8 | script_file=/usr/sbin/dhclient-script |
| 9 | |
| 10 | start() { |
| 11 | /usr/sbin/dhclient -q -nw -cf $config_file -lf $lease_file -pf $pid_file -sf $script_file `/sbin/uci get network.wan.ifname` |
| 12 | |
| 13 | if [ $? -ne 0 ]; then |
| 14 | return 1 |
| 15 | fi |
| 16 | } |
| 17 | |
| 18 | stop() { |
| 19 | if [ ! -e $pid_file ]; then |
| 20 | return 1 |
| 21 | fi |
| 22 | |
| 23 | kill -9 `cat $pid_file` |
| 24 | |
| 25 | if [ $? -ne 0 ]; then |
| 26 | return 1 |
| 27 | fi |
| 28 | |
| 29 | rm $pid_file |
| 30 | } |