Systemd с несколькими экземплярами и перезапуск в случае сбоя

Мне нужно было добавить URL в sources.list. И чтобы иметь возможность динамически указывать кодовое имя версии, я использую этот фрагмент кода (, полагаясь на тот факт, что кодовое имя находится в скобках ):. Вдохновленный @PersianGulfответ .

grep "VERSION=" /etc/os-release |awk -F= {' print tolower($2)'}|sed s/\.*\(//g | sed s/" ".*\"//g

0
26.08.2020, 23:00
1 ответ

Вы добавили связь Requires=между целью и экземпляром. Это довольно крепкие отношения. Согласно systemd.unit (5)это означает:

Requires=

Similar to Wants=, but declares a stronger dependency. Dependencies of this type may also be configured by adding a symlink to a.requires/ directory accompanying the unit file.

If this unit gets activated, the units listed will be activated as well. If one of the other units fails to activate, and an ordering dependency After= on the failing unit is set, this unit will not be started. Besides, with or without specifying After=, this unit will be stopped if one of the other units is explicitly stopped.

Often, it is a better choice to use Wants= instead of Requires= in order to achieve a system that is more robust when dealing with failing services.

Таким образом, если вы измените Requires=на Wants=, то при запуске целевого объекта будут запущены шаблонные службы, но сбой шаблонного сервиса не повлияет на целевое устройство.

0
18.03.2021, 23:09

Теги

Похожие вопросы