我在多個伺服器上遇到問題(發生了兩次,每月一次),Daily apt upgrade and clean activities
由於某種原因啟動停止了我的特定服務,然後從未啟動它,所以它被關閉,然後我需要手動啟動它。
在系統日誌中我看到這個:
Mar 7 06:59:24 server systemd[1]: Starting Daily apt upgrade and clean activities...
Mar 7 06:59:38 server systemd[1]: Reloading.
Mar 7 06:59:38 server systemd[1]: Started ACPI event daemon.
Mar 7 06:59:38 server systemd[1]: Stopping Odoo 11...
Mar 7 06:59:39 server systemd[1]: Stopped Odoo 11.
Mar 7 06:59:39 server systemd[1]: Stopped PostgreSQL RDBMS.
Mar 7 06:59:39 server systemd[1]: Stopping PostgreSQL Cluster 9.5-main...
Mar 7 06:59:41 server systemd[1]: Stopped PostgreSQL Cluster 9.5-main.
Mar 7 06:59:42 server systemd[1]: Reloading.
Mar 7 06:59:42 server systemd[1]: Starting Daily apt download activities...
Mar 7 06:59:42 server systemd[1]: Started ACPI event daemon.
Mar 7 06:59:42 server systemd[1]: Reloading.
Mar 7 06:59:42 server systemd[1]: Started ACPI event daemon.
Mar 7 06:59:42 server systemd[1]: Starting PostgreSQL Cluster 9.5-main...
Mar 7 06:59:45 server systemd[1]: Started PostgreSQL Cluster 9.5-main.
Mar 7 06:59:45 server systemd[1]: Starting PostgreSQL RDBMS...
Mar 7 06:59:45 server systemd[1]: Started PostgreSQL RDBMS.
Mar 7 06:59:51 server systemd[1]: Started Daily apt upgrade and clean activities.
Mar 7 06:59:59 server systemd[1]: Started Daily apt download activities.
正如您從日誌中看到的,當它啟動時,它也會啟動 ACPI 事件守護進程,然後停止Odoo 11
服務,但服務保持停止狀態,即使它不應該停止。
這是 Odoo 11 服務的 systemd 配置:
[Unit]
Description=Odoo 11
Requires=postgresql.service
After=postgresql.service
[Service]
Type=simple
PermissionsStartOnly=true
User=odoo
Group=odoo
SyslogIdentifier=odoo11
ExecStart=/opt/odoo/venv/bin/python3 /opt/odoo/odoo/odoo-bin -c /etc/odoo11.conf
[Install]
WantedBy=multi-user.target
也許 systemd 啟動-停止服務配置有問題?不過,如果我自己運行該服務,它就會按預期工作。
答案1
您可能想要使用Wants=
PostgreSQL 服務依賴項而不是Requires=
.
使用Wants=
,您的應用程式不會僅僅因為 PostgreSQL 因軟體升級而停止/啟動而停止。
請閱讀有關其中差異的更多資訊man systemd.unit
。