Jump to content

Recommended Posts

Posted

Это баг какой то что дублируются события ppp0?

 

Что в системном журнале (interface is up)

qzpD4S.png

Что хуки срабатывают два раза:
ndm/wan.d (дубль start)

=== Hook script executed at Sat May 24 12:23:48 +05 2025 ===
First parameter: stop
Environment variables:
  interface=
  address=
  mask=
  gateway=
-----
=== Hook script executed at Sat May 24 12:23:50 +05 2025 ===
First parameter: start
Environment variables:
  interface=ppp0
  address=100.120.221.94
  mask=255.255.255.255
  gateway=0.0.0.0
-----
=== Hook script executed at Sat May 24 12:23:50 +05 2025 ===
First parameter: start
Environment variables:
  interface=ppp0
  address=100.120.221.94
  mask=255.255.255.255
  gateway=0.0.0.0
-----


ndm/ifstatechanged.d (дубль change=link)

=== Hook script executed at Sat May 24 12:23:43 +05 2025 ===
First parameter: hook
Environment variables:
  id=PPPoE0
  system_name=ppp0
  link=up
  connected=yes
  up=down
  change=up
-----
=== Hook script executed at Sat May 24 12:23:43 +05 2025 ===
First parameter: hook
Environment variables:
  id=PPPoE0
  system_name=ppp0
  link=up
  connected=yes
  up=down
  change=config
-----
=== Hook script executed at Sat May 24 12:23:43 +05 2025 ===
First parameter: hook
Environment variables:
  id=PPPoE0
  system_name=ppp0
  link=up
  connected=yes
  up=up
  change=up
-----
=== Hook script executed at Sat May 24 12:23:43 +05 2025 ===
First parameter: hook
Environment variables:
  id=PPPoE0
  system_name=ppp0
  link=up
  connected=yes
  up=up
  change=config
-----
=== Hook script executed at Sat May 24 12:23:43 +05 2025 ===
First parameter: hook
Environment variables:
  id=PPPoE0
  system_name=ppp0
  link=down
  connected=no
  up=up
  change=link
-----
=== Hook script executed at Sat May 24 12:23:43 +05 2025 ===
First parameter: hook
Environment variables:
  id=PPPoE0
  system_name=ppp0
  link=down
  connected=no
  up=up
  change=link
-----
=== Hook script executed at Sat May 24 12:23:48 +05 2025 ===
First parameter: hook
Environment variables:
  id=PPPoE0
  system_name=ppp0
  link=up
  connected=yes
  up=up
  change=link
-----


Keenetic Giga II 2.16.D.12.0-11
Настройки сбрасывал, настраивал через мастер быстрой настройки.
Можно поправить?

Posted

Это не является проблемой, скрипты должны быть идемпотентны (позволять вызывать себя неограниченное количество раз с теми же самыми аргументами).

Posted (edited)
8 часов назад, Le ecureuil сказал:

Это не является проблемой, скрипты должны быть идемпотентны (позволять вызывать себя неограниченное количество раз с теми же самыми аргументами).

Не совсем понял что-то. Если у меня скрипт в wan.d то при подключении ppp0 (с аргументом start) он сработает два раза
аналогично в ifstatechanged.d, при отключении ppp0 change=link & connected=no он сработает два раза

Вот что я имею ввиду

 

#!/bin/sh

case "$1" in
    start)
        echo $(date) Internet connection established >> /opt/var/log/wan.d_logger.log
        ;;
    stop)
        echo $(date) Internet connection terminated >> /opt/var/log/wan.d_logger.log
        ;;
esac

>wan.d_logger.log
Sun May 25 20:54:17 +05 2025 Internet connection established
Sun May 25 20:54:18 +05 2025 Internet connection established

Sun May 25 21:01:42 +05 2025 Internet connection terminated
Sun May 25 21:01:43 +05 2025 Internet connection established
Sun May 25 21:01:44 +05 2025 Internet connection established

Sun May 25 21:03:21 +05 2025 Internet connection terminated
Sun May 25 21:03:22 +05 2025 Internet connection established
Sun May 25 21:03:23 +05 2025 Internet connection established


 

#!/bin/sh

if [ "$system_name" = "eth2.2" ] && [ "$change" = "link" ]; then
    echo $(date) eth2.2 interface is $link >> /opt/var/log/ifstatechanged.d_logger.log
fi

if [ "$system_name" = "ppp0" ] && [ "$change" = "link" ]; then
    echo $(date) ppp0 current connection status $connected >> /opt/var/log/ifstatechanged.d_logger.log
fi

>ifstatechanged.d_logger.log
Sun May 25 20:54:10 +05 2025 eth2.2 interface is up
Sun May 25 20:54:12 +05 2025 ppp0 current connection status yes
Sun May 25 21:01:37 +05 2025 ppp0 current connection status no
Sun May 25 21:01:37 +05 2025 ppp0 current connection status no

Sun May 25 21:01:42 +05 2025 ppp0 current connection status yes
Sun May 25 21:03:14 +05 2025 ppp0 current connection status no
Sun May 25 21:03:14 +05 2025 ppp0 current connection status no

Sun May 25 21:03:21 +05 2025 ppp0 current connection status yes



Если это не проблема, тогда как быть, есть какой нибудь вариант чтобы скрипт отработал только один раз?

Edited by Next
Posted
В 25.05.2025 в 14:06, Next сказал:


Если это не проблема, тогда как быть, есть какой нибудь вариант чтобы скрипт отработал только один раз?

Вы должны решить ее сами, так как в изначальном дизайне opkg и скриптов задумано, что они с одними и теми же аргументами могут вызываться ЛЮБОЕ отличное от нуля число раз на одно и то же событие. Это данность, так есть и будет. Тем более в версии 2.16, никто не будет даже разбираться почему там такое происходит.

  • Thanks 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

This site uses cookies. By clicking "I accept" or continuing to browse the site, you authorize their use in accordance with the Privacy Policy.