30 lines
509 B
Bash
30 lines
509 B
Bash
#!/bin/sh /etc/rc.common
|
|
|
|
START=60
|
|
|
|
lease_file=/var/dhclient.leases
|
|
config_file=/etc/dhclient.conf
|
|
pid_file=/var/run/dhclient.pid
|
|
script_file=/usr/sbin/dhclient-script
|
|
|
|
start() {
|
|
local ifname
|
|
|
|
. /lib/functions/network.sh
|
|
|
|
network_get_device ifname "wan" || return 1
|
|
|
|
/usr/sbin/dhclient -q -nw -cf $config_file -lf $lease_file -pf $pid_file -sf $script_file $ifname
|
|
|
|
[ $? -eq 0 ] || return 1
|
|
}
|
|
|
|
stop() {
|
|
[ -e $pid_file ] || return 1
|
|
|
|
kill -9 $(cat $pid_file)
|
|
|
|
[ $? -eq 0 ] || return 1
|
|
|
|
rm $pid_file
|
|
}
|