ПО МКА-3/en: различия между версиями

Материал из Wiren Board
(Новая страница: «Package wb-dbic establishes and maintains templates of the configuration files in the directory /etc/wb-dbic/templates/. For example the template for the file /et…»)
(Новая страница: «Configuration files are generated by calling the dbic_gen_conf script. The script gets the variables for the configuration from the SCU, and then processes the fi…»)
Строка 26: Строка 26:
For example the template for the file /etc/network/interfaces is stored in the file /etc/wb-dbic/templates/etc/network/interfaces.template.
For example the template for the file /etc/network/interfaces is stored in the file /etc/wb-dbic/templates/etc/network/interfaces.template.


Конфигурационные файлы генерируются посредством вызова скрипта dbic_gen_conf.
Configuration files are generated by calling the dbic_gen_conf script.
Скрипт получает переменные для конфигурирования от SCU, после чего обрабатывает файлы из директории /etc/wb-dbic/templates.
The script gets the variables for the configuration from the SCU, and then processes the files in the directory /etc/wb-dbic/templates.
Обрабатываются только файлы с расширением .template.
Only files with the .template extension are processed.


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

Версия 17:44, 18 июля 2019

Другие языки:

Main article Wiren Board NETMON-1

Restart SCU (rear relays)

The daemon dbic-pcycle.py is responsible for controlling the rear relays.

Start/stop daemon:

/etc/init.d/wb-dbic-pcycle start
/etc/init.d/wb-dbic-pcycle stop

The daemon listens to commands on the bus MQTT. There are three different ways to trigger a SCU reboot, i.e. send an MQTT command to the daemon:

  • Via the web interface in the Back relays section
  • With the command dbic_invoke_pcycle.sh in the console
  • By sending a command via MQT
mosquitto_pub -h <ip-адрес МКА> -t "/devices/dbic-power-cycle/controls/power/on" -m "0" -q 2


Configuration mechanism

Configuration

Package wb-dbic establishes and maintains templates of the configuration files in the directory /etc/wb-dbic/templates/. For example the template for the file /etc/network/interfaces is stored in the file /etc/wb-dbic/templates/etc/network/interfaces.template.

Configuration files are generated by calling the dbic_gen_conf script. The script gets the variables for the configuration from the SCU, and then processes the files in the directory /etc/wb-dbic/templates. Only files with the .template extension are processed.

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

Изменения в конфигурационных файлах не сохраняются. Изменения в темплейтах в директории /etc/wb-dbic/templates обрабатываются стандартным механизмом conffiles в dpkg: при установке обновлённого пакета и при наличии локальных правок пользователю будут предложены варианты дальнейших действий.


Настройка сети

Т.к. получение переменных для подстановки в темплейты происходит по сети, то отдельно предоставляется первоначальный файл с настройками сети - /etc/network/interfaces.


Добавление конфигурационных файлов в систему

Добавление других конфигурационных файлов в систему автоконфигурирования должно производиться через обновление пакета wb-dbic (с увеличением версии). При этом, если нужный файл предоставляется каким-либо пакетом, то необходимо пользоваться функционалом dpkg-divert или dpkg-divert в сочетании с ucf, чтобы предотвратить перезаписывание файла при обновлении исходного пакета.