[OpenWrt-Devel] [RFC] procd: Allow to enable endless respawning of services

Etienne Champetier champetier.etienne at gmail.com
Mon Sep 21 12:05:42 EDT 2015


Hi,

2015-09-21 17:26 GMT+02:00 Helmut Schaa <helmut.schaa at googlemail.com>:

> Extend /etc/config/system with a parameter to enable
> infinite respawn mode:
>
>         config system
>                 option service_endless_respawn 1
>

why not "service_respawn_retry", which set "respawn_retry" default value
(if i want to set 20 instead of -1, so a bad service stop using cpu at one
point)



>
> All services that don't specify specific respawn parameters
> will get their defaults added by procd.sh and if service_endless_respawn
> is set respawn_retry will be set to -1. This makes procd to
> respawn the service forever.
>
> Signed-off-by: Helmut Schaa <helmut.schaa at googlemail.com>
> ---
>  package/system/procd/files/procd.sh | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/package/system/procd/files/procd.sh
> b/package/system/procd/files/procd.sh
> index e83e75c..04111b9 100644
> --- a/package/system/procd/files/procd.sh
> +++ b/package/system/procd/files/procd.sh
> @@ -316,6 +316,18 @@ _procd_append_param() {
>  }
>
>  _procd_close_instance() {
> +       local respawn_vals
> +       if json_select respawn ; then
> +               json_get_values respawn_vals
> +               if [ -z "$respawn_vals" ]; then
> +                       # Set respawn defaults
> +                       local respawn_retry
> +                       [[ -n "$(uci_get system. at system[0].service_endless_respawn)"
> ]] && respawn_retry=-1
> +                       _procd_add_array_data 3600 5 ${respawn_retry:-5}
> +               fi
> +               json_select ..
> +       fi
> +
>         json_close_object
>  }
>
> --
> 1.8.4.5
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20150921/36d1464c/attachment.htm>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list