procd.sh: use parameterized respawn values

continue work started here: http://patchwork.ozlabs.org/patch/520859

Extend /etc/config/system with parameters to set the default respawn treshold and respawn timeout
	for procd launched services that have respawn enabled.
This results in cleaner init scripts, while making sure services have respawn parameters set.

Signed-off-by: Claudiu Brasovean <cbrasho@gmail.com>
owl
Claudiu Brasovean 2017-02-28 11:51:01 +02:00 committed by Felix Fietkau
parent 0504cd22aa
commit c70c6ac070
1 changed files with 3 additions and 1 deletions

View File

@ -351,8 +351,10 @@ _procd_close_instance() {
if json_select respawn ; then if json_select respawn ; then
json_get_values respawn_vals json_get_values respawn_vals
if [ -z "$respawn_vals" ]; then if [ -z "$respawn_vals" ]; then
local respawn_threshold=$(uci_get system.@service[0].respawn_threshold)
local respawn_timeout=$(uci_get system.@service[0].respawn_timeout)
local respawn_retry=$(uci_get system.@service[0].respawn_retry) local respawn_retry=$(uci_get system.@service[0].respawn_retry)
_procd_add_array_data 3600 5 ${respawn_retry:-5} _procd_add_array_data ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
fi fi
json_select .. json_select ..
fi fi