浏览代码

why procd_open_instance can not start sh

rufengsuixing 5 年之前
父节点
当前提交
a666f2f559
共有 1 个文件被更改,包括 5 次插入6 次删除
  1. 5 6
      root/etc/init.d/AdGuardHome

+ 5 - 6
root/etc/init.d/AdGuardHome

@@ -298,9 +298,7 @@ boot() {
 	config_get waitonboot $CONFIGURATION waitonboot "0"
 	if [ "$waitonboot" == "1" ]; then
 		do_redirect 0
-		procd_open_instance "waitnet"
-		procd_set_param command "/usr/share/AdGuardHome/waitnet.sh"
-		procd_close_instance
+		/usr/share/AdGuardHome/waitnet.sh &
 	else
 		start
 	fi
@@ -392,9 +390,8 @@ start_service() {
 		do_redirect 0
 		config_get "redirect" "AdGuardHome" "redirect" "none"
 		if [ "$redirect" != "none" ]; then
-			procd_open_instance "waitconfig"
-			procd_set_param command "/usr/share/AdGuardHome/watchconfig.sh"
-			procd_close_instance
+			/usr/share/AdGuardHome/watchconfig.sh &
+			echo "no config start watching"
 		fi
 	fi
 	echo "AdGuardHome turn on"
@@ -418,6 +415,8 @@ stop_service()
 	config_load "${CONFIGURATION}"
 	do_redirect 0
 	procd_send_signal $CONFIGURATION
+	pgrep /usr/share/AdGuardHome/watchconfig.sh | xargs kill 2>/dev/null
+	pgrep /usr/share/AdGuardHome/waitnet.sh | xargs kill 2>/dev/null
 	echo "AdGuardHome turn off"
 	echo "enabled=$enabled"
 }