maltfield
(Michael Altfield)
1
Discourse の Docker コンテナ内の /etc/cron.d/ にファイルを作成するためのテンプレートを追加しましたが、cron ジョブが実行されません。代わりに、Docker コンテナの syslog に以下のエントリが表示されます。
===> /var/log/syslog <===
Apr 22 11:45:01 osestaging1-discourse-ose CRON[30055]: Cannot make/remove an entry for the specified session
Discourse の Docker コンテナ内で cron ジョブを実行するには、どのように定義すればよいでしょうか?
maltfield
(Michael Altfield)
2
これは Docker と Debian のバグによるものです。すでに修正されていますが、Discourse の Docker イメージにはまだ適用されていないようです(?)。
上記のリンクに従い、以下のテンプレートファイルを使用して、[a] /etc/cron.d/ ファイルを作成し、[b] cron の pam モジュールのバグを修正しました:
[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]#
残念ながら、cron の pam.d モジュールに変更を加えることによるすべての影響を 100% 理解しているわけではありません。しかし、これは上流で認められた修正策のようにも思えます :\
関連情報:Does Discourse container use unattended-upgrades? - #9 by maltfield
system
(system)
クローズされました:
3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.