make network scripts more robust, prevent multiple instances of pppd and udhcpc for the same interface

SVN-Revision: 5290
This commit is contained in:
Felix Fietkau
2006-10-24 23:59:08 +00:00
parent 2f78952da8
commit 315f8e954b
4 changed files with 27 additions and 21 deletions

View File

@@ -7,6 +7,11 @@ scan_ppp() {
start_pppd() {
local cfg="$1"; shift
# make sure only one pppd process is started
local pid="$(cat /var/run/ppp-${cfg}.pid 2>/dev/null)"
[ -d "/proc/$pid" ] && grep pppd "/proc/$pid/cmdline" 2>/dev/null >/dev/null && return 0
config_get device "$cfg" device
config_get unit "$cfg" unit
config_get username "$cfg" username