1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2025-04-21 12:27:27 +03:00

[backfire] merge r23087, r23091 and r23092

git-svn-id: svn://svn.openwrt.org/openwrt/branches/backfire@23094 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow
2010-09-19 15:18:07 +00:00
parent 24f82abcc8
commit 1ac7fd2661
4 changed files with 43 additions and 39 deletions

View File

@@ -274,4 +274,21 @@ uci_apply_defaults() {
uci commit
}
service_kill() {
local name="${1}"
local pid="${2:-$(pidof "$name")}"
local grace="${3:-5}"
[ -f "$pid" ] && pid="$(head -n1 "$pid" 2>/dev/null)"
for pid in $pid; do
[ -d "/proc/$pid" ] || continue
local try=0
kill -TERM $pid 2>/dev/null && \
while grep -qs "$name" "/proc/$pid/cmdline" && [ $((try++)) -lt $grace ]; do sleep 1; done
kill -KILL $pid 2>/dev/null && \
while grep -qs "$name" "/proc/$pid/cmdline"; do sleep 1; done
done
}
[ -z "$IPKG_INSTROOT" -a -f /lib/config/uci.sh ] && . /lib/config/uci.sh