On Mon, Sep 21, 2015 at 6:14 PM, Yousong Zhou <[email protected]> wrote:
> Hi, Helmut
>
> On 21 September 2015 at 23:26, Helmut Schaa <[email protected]> 
> wrote:
>> Extend /etc/config/system with a parameter to enable
>> infinite respawn mode:
>>
>>         config system
>>                 option service_endless_respawn 1
>>
>> 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.
>
> How about making it a separate section like "config service", then we
> can later add other default service options, e.g. "limits
> core=unlimited".

Makes sense I guess.

>>
>> Signed-off-by: Helmut Schaa <[email protected]>
>> ---
>>  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.@system[0].service_endless_respawn)" ]] && respawn_retry=-1
>
> I think the convention here is to use "[ ]" instead of "[[ ]]".  also
> please use something like "$(uci -q get ...)" or "$(uci get ...
> 2>/dev/null)" to squash the possible "Entry not found" error there.

uci_get from /lib/config/uci.sh handles that just fine.

Helmut
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to