1 Star 0 Fork 23

tmacbb/initscripts

forked from src-openEuler/initscripts 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
new-network-fork-to-start-dhcp.patch 2.34 KB
一键复制 编辑 原始数据 按行查看 历史
hanzj0122_admin 提交于 2020-07-24 11:24 +08:00 . update to 10.04
From ad95c2dae06794a37e500e07e13cee8328ddfb5d Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Tue, 24 Sep 2019 17:39:52 +0800
Subject: [PATCH] initscripts: add network start dhcp process background
reason:add network start dhcp process background
Signed-off-by: rpm-build <rpm-build>
---
etc/rc.d/init.d/network | 36 +++++++++++++++++++++++++++++++-----
1 file changed, 31 insertions(+), 5 deletions(-)
diff --git a/etc/rc.d/init.d/network b/etc/rc.d/init.d/network
index 31bbe20..994425d 100755
--- a/etc/rc.d/init.d/network
+++ b/etc/rc.d/init.d/network
@@ -49,6 +49,8 @@ interfaces=$(ls ifcfg-* | \
LC_ALL=C sed 's/ //')
rc=0
+godamon=0
+
net_log $"You are using 'network' service provided by 'network-scripts', which are now deprecated." warning network >&2
net_log $"'network-scripts' will be removed from distribution in near future." warning network >&2
net_log $"It is advised to switch to 'NetworkManager' instead for network management." warning network >&2
@@ -129,18 +131,39 @@ start)
is_available $i
continue
fi
- action $"Bringing up interface $i: " ./ifup $i boot
- [ $? -ne 0 ] && rc=1
+ if [ "$godamon" != "1" ] ; then
+ action $"Bringing up interface $i: " ./ifup $i boot
+ [ $? -ne 0 ] && rc=1
+ else
+ action $"Bringing up interface $i: " ./ifup $i boot &
+ fi
done
# Bring up xDSL and VPN interfaces
for i in $vlaninterfaces $bridgeinterfaces $xdslinterfaces $vpninterfaces ; do
if ( . ./ifcfg-"$i" ; ! is_false "$ONBOOT" ) ; then
- action $"Bringing up interface $i: " ./ifup $i boot
- [ $? -ne 0 ] && rc=1
+ if [ "$godamon" != "1" ] ; then
+ action $"Bringing up interface $i: " ./ifup $i boot
+ [ $? -ne 0 ] && rc=1
+ else
+ action $"Bringing up interface $i: " ./ifup $i boot &
+ fi
fi
done
-
+ # Waiting until all background process done
+ if [ "$godamon" = "1" ] ; then
+ for pid in $(jobs -p)
+ do
+ wait $pid
+ status=$?
+ if [ $status != 0 ] ;then
+ net_log "Unable to obtain DHCP addresas."
+ rc=1
+ continue
+ fi
+ rc=0
+ done
+ fi
# Add non interface-specific static-routes.
if [ -f /etc/sysconfig/static-routes ]; then
if [ -x /sbin/route ]; then
--
2.19.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tmacbb/initscripts.git
git@gitee.com:tmacbb/initscripts.git
tmacbb
initscripts
initscripts
master

搜索帮助