<p dir="ltr"><br>
Am 16.10.2014 14:59 schrieb "Bastian Bittorf" <<a href="mailto:bittorf@bluebottle.com">bittorf@bluebottle.com</a>>:<br>
><br>
> [netifd/scripts] make netifd scripts recognize signal strings such as INT/TERM/KILL/...<br>
><br>
> instead of let the caller do the conversion of symbolic to numeric (e.g. SIGUSR1 -> 16),<br>
> do the conversion internally - the old mode (numeric) is still supported<br>
><br>
> Signed-off-by: Bastian Bittorf <<a href="mailto:bittorf@bluebottle.com">bittorf@bluebottle.com</a>><br>
> ---<br>
>  scripts/netifd-proto.sh |   15 +++++++++++++--<br>
>  1 file changed, 13 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/scripts/netifd-proto.sh b/scripts/netifd-proto.sh<br>
> index ce316c4..6625053 100644<br>
> --- a/scripts/netifd-proto.sh<br>
> +++ b/scripts/netifd-proto.sh<br>
> @@ -286,11 +286,22 @@ proto_run_command() {<br>
>  }<br>
><br>
>  proto_kill_command() {<br>
> -       local interface="$1"; shift<br>
> +       local interface="$1"<br>
> +       local signal="$2"<br>
><br>
>         json_init<br>
>         json_add_int action 2<br>
> -       [ -n "$1" ] && json_add_int signal "$1"<br>
> +<br>
> +       case "$signal" in<br>
> +               [0-9]|[0-9][0-9])<br>
> +                       json_add_int signal "$signal"<br>
> +               ;;<br>
> +               [a-zA-Z]*)<br>
> +                       signal="$( kill -l "$signal" )"</p>
<p dir="ltr">the quotes may not work...</p>
<p dir="ltr">        yousong</p>
<p dir="ltr">> +                       json_add_int signal "$signal"<br>
> +               ;;<br>
> +       esac<br>
> +<br>
>         _proto_notify "$interface"<br>
>  }<br>
><br>
> --<br>
> 1.7.10.4<br>
> _______________________________________________<br>
> openwrt-devel mailing list<br>
> <a href="mailto:openwrt-devel@lists.openwrt.org">openwrt-devel@lists.openwrt.org</a><br>
> <a href="https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel">https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel</a></p>