Jump to content
  • 1

opkg: Выполнение скриптов /opt/etc/ndm/*.d/ в сортированном порядке


Александр Рыжов

Question

Столкнулся с тем, что скрипты /opt/etc/ndm/*.d/ выполняются в произвольном порядке.

Создаю скрипт со следующим содержимым…

# cat script_template.sh
#!/bin/sh

echo $0 executed at $(date) >> /opt/var/log/script.log

…и помещаю несколько его копий в /opt/etc/ndm/netfilter.d. После перезагрузки:

# cat /opt/var/log/script.log
/opt/etc/ndm/netfilter.d/003-three.sh executed at Wed Jul 27 08:55:53 UTC 2016
/opt/etc/ndm/netfilter.d/005-five.sh executed at Wed Jul 27 08:55:53 UTC 2016
/opt/etc/ndm/netfilter.d/004-four.sh executed at Wed Jul 27 08:55:53 UTC 2016
/opt/etc/ndm/netfilter.d/001-one.sh executed at Wed Jul 27 08:55:53 UTC 2016
/opt/etc/ndm/netfilter.d/002-two.sh executed at Wed Jul 27 08:55:53 UTC 2016
/opt/etc/ndm/netfilter.d/003-three.sh executed at Wed Jul 27 08:55:53 UTC 2016
/opt/etc/ndm/netfilter.d/005-five.sh executed at Wed Jul 27 08:55:53 UTC 2016
/opt/etc/ndm/netfilter.d/004-four.sh executed at Wed Jul 27 08:55:53 UTC 2016
/opt/etc/ndm/netfilter.d/001-one.sh executed at Wed Jul 27 08:55:53 UTC 2016
/opt/etc/ndm/netfilter.d/002-two.sh executed at Wed Jul 27 08:55:53 UTC 2016
/opt/etc/ndm/netfilter.d/003-three.sh executed at Wed Jul 27 08:55:53 UTC 2016
/opt/etc/ndm/netfilter.d/005-five.sh executed at Wed Jul 27 08:55:53 UTC 2016
/opt/etc/ndm/netfilter.d/004-four.sh executed at Wed Jul 27 08:55:53 UTC 2016
/opt/etc/ndm/netfilter.d/001-one.sh executed at Wed Jul 27 08:55:53 UTC 2016
/opt/etc/ndm/netfilter.d/002-two.sh executed at Wed Jul 27 08:55:53 UTC 2016
/opt/etc/ndm/netfilter.d/003-three.sh executed at Wed Jul 27 08:55:55 UTC 2016
/opt/etc/ndm/netfilter.d/005-five.sh executed at Wed Jul 27 08:55:55 UTC 2016
/opt/etc/ndm/netfilter.d/004-four.sh executed at Wed Jul 27 08:55:55 UTC 2016
/opt/etc/ndm/netfilter.d/001-one.sh executed at Wed Jul 27 08:55:55 UTC 2016
/opt/etc/ndm/netfilter.d/002-two.sh executed at Wed Jul 27 08:55:55 UTC 2016

Параллельное исполнение призвано исключить тормоза? Для последовательного выполнения скриптов лучше написать собственную обвязку?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Порядок. Во всех смыслах.

root@Keenetic_Omni:~# cat script.log
/opt/etc/ndm/netfilter.d/001.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/002.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/003.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/004.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/005.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/001.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/002.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/003.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/004.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/005.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/001.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/002.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/003.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/004.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/005.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/001.sh executed at Mon Aug 1 06:01:40 UTC 2016
/opt/etc/ndm/netfilter.d/002.sh executed at Mon Aug 1 06:01:40 UTC 2016
/opt/etc/ndm/netfilter.d/003.sh executed at Mon Aug 1 06:01:40 UTC 2016
/opt/etc/ndm/netfilter.d/004.sh executed at Mon Aug 1 06:01:40 UTC 2016
/opt/etc/ndm/netfilter.d/005.sh executed at Mon Aug 1 06:01:40 UTC 2016
/opt/etc/ndm/netfilter.d/001.sh executed at Mon Aug 1 06:01:41 UTC 2016
/opt/etc/ndm/netfilter.d/002.sh executed at Mon Aug 1 06:01:41 UTC 2016
/opt/etc/ndm/netfilter.d/003.sh executed at Mon Aug 1 06:01:41 UTC 2016
/opt/etc/ndm/netfilter.d/004.sh executed at Mon Aug 1 06:01:41 UTC 2016
/opt/etc/ndm/netfilter.d/005.sh executed at Mon Aug 1 06:01:41 UTC 2016

Спасибо за работу.

ЗЫ: судя по логу, после перезагрузки скрипты netfilter.d дёргались пять раз несмотря на IPoE-подключение. Так и должно быть?

Link to comment
Share on other sites

  • 0

При запуске скриптов из *.d выполнение идёт последовательно. Сортировки и правда не было, добавим для определенности.

  • Thanks 1
Link to comment
Share on other sites

  • 0
15 минут назад, Александр Рыжов сказал:

Порядок. Во всех смыслах.


root@Keenetic_Omni:~# cat script.log
/opt/etc/ndm/netfilter.d/001.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/002.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/003.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/004.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/005.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/001.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/002.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/003.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/004.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/005.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/001.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/002.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/003.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/004.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/005.sh executed at Mon Aug 1 06:01:38 UTC 2016
/opt/etc/ndm/netfilter.d/001.sh executed at Mon Aug 1 06:01:40 UTC 2016
/opt/etc/ndm/netfilter.d/002.sh executed at Mon Aug 1 06:01:40 UTC 2016
/opt/etc/ndm/netfilter.d/003.sh executed at Mon Aug 1 06:01:40 UTC 2016
/opt/etc/ndm/netfilter.d/004.sh executed at Mon Aug 1 06:01:40 UTC 2016
/opt/etc/ndm/netfilter.d/005.sh executed at Mon Aug 1 06:01:40 UTC 2016
/opt/etc/ndm/netfilter.d/001.sh executed at Mon Aug 1 06:01:41 UTC 2016
/opt/etc/ndm/netfilter.d/002.sh executed at Mon Aug 1 06:01:41 UTC 2016
/opt/etc/ndm/netfilter.d/003.sh executed at Mon Aug 1 06:01:41 UTC 2016
/opt/etc/ndm/netfilter.d/004.sh executed at Mon Aug 1 06:01:41 UTC 2016
/opt/etc/ndm/netfilter.d/005.sh executed at Mon Aug 1 06:01:41 UTC 2016

Спасибо за работу.

ЗЫ: судя по логу, после перезагрузки скрипты netfilter.d дёргались пять раз несмотря на IPoE-подключение. Так и должно быть?

Да, netfilter у нас переконфигурируется часто и по не всегда очевидным для пользователя прошивки причинам :) Нужно быть готовым к столь частым вызовам.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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