maltfield
(Michael Altfield)
23.Апрель.2020 09:55:44
1
Я добавил шаблон для создания файла в /etc/cron.d/ внутри моего контейнера Docker с Discourse, но задача cron не выполняется! Вместо этого я вижу следующую запись в системном журнале (syslog) контейнера Docker:
==> /var/log/syslog <==
Apr 22 11:45:01 osestaging1-discourse-ose CRON[30055]: Cannot make/remove an entry for the specified session
Как можно определить задачу cron для выполнения внутри моего контейнера Docker с Discourse?
maltfield
(Michael Altfield)
23.Апрель.2020 09:59:09
2
Это результат ошибки в Docker и Debian. Она уже исправлена, но, судя по всему, пока не для Docker-образа Discourse (или?).
Согласно указанной ссылке, я использовал следующий шаблонный файл, чтобы [a] создать файл /etc/cron.d/ и [b] исправить ошибку в модуле PAM cron:
[root@osestaging1 discourse]# cat /var/discourse/templates/unattended-upgrades.template.yml run:
- file:
path: /etc/cron.d/unattended-upgrades
contents: |+
################################################################################
# File: /etc/cron.d/unattended-upgrades
# Version: 0.1
# Purpose: run unattended-upgrades in lieu of systemd. For more info see
# * https://wiki.opensourceecology.org/wiki/Discourse
# * https://meta.discourse.org/t/does-discourse-container-use-unattended-upgrades/136296/3
# Author: Michael Altfield <michael@opensourceecology.org>
# Created: 2020-03-23
# Updated: 2020-03-23
################################################################################
20 04 * * * root /usr/bin/nice /usr/bin/unattended-upgrades --debug
- exec: /bin/echo -e "\n" >> /etc/cron.d/unattended-upgrades
# fix the Docker cron bug https://stackoverflow.com/questions/43323754/cannot-make-remove-an-entry-for-the-specified-session-cron
- exec: /bin/sed --in-place=.`date "+%Y%m%d_%H%M%S"` 's%^\([^#]*\)\(session\s\+required\s\+pam_loginuid\.so\)$%\1#\2%' /etc/pam.d/cron
[root@osestaging1 discourse]#
К сожалению, я не на 100% уверен во всех последствиях такого изменения модуля PAM cron.d. Но мне кажется, что это признанное исправление upstream :\
См. также: Does Discourse container use unattended-upgrades? - #9 by maltfield