Browse Source

use proc kill command and respawn

stderr to syslog
rufengsuixing 5 years ago
parent
commit
daa0a7acdc
1 changed files with 6 additions and 7 deletions
  1. 6 7
      root/etc/init.d/AdGuardHome

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

@@ -316,7 +316,9 @@ start_service() {
 	fi
 	if [ "$enabled" == "1" ]; then
 		procd_open_instance
-		procd_set_param respawn
+		procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
+		procd_set_param limits core="unlimited"
+		procd_set_param stderr 1 
 		# pass config to script on start
 		procd_set_param command $binpath $ADDITIONAL_ARGS
 		procd_close_instance
@@ -324,8 +326,7 @@ start_service() {
 			do_redirect 1
 		fi
 		echo "AdGuardHome turn on"
-		echo "enabled="$enabled""
-		uci set $CONFIGURATION.$CONFIGURATION.lastbinpath=$binpath
+		echo "enabled=$enabled"
 	fi
 }
 
@@ -333,10 +334,8 @@ stop_service()
 {
 	config_get configpath $CONFIGURATION configpath "/etc/AdGuardHome.yaml"
 	config_get binpath $CONFIGURATION binpath "/usr/bin/AdGuardHome/AdGuardHome"
-	mkdir -p ${binpath%/*}
 	do_redirect 0
-	config_get lastbinpath $CONFIGURATION lastbinpath $binpath
-	pgrep $lastbinpath | xargs kill
+	procd_send_signal $CONFIGURATION
 	echo "AdGuardHome turn off"
-	echo "enabled="$enabled""
+	echo "enabled=$enabled"
 }