Не совсем понял что-то. Если у меня скрипт в 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
Если это не проблема, тогда как быть, есть какой нибудь вариант чтобы скрипт отработал только один раз?