大网数据广告活动
服务器运维问答

Teamcity Build Agent gets killed by systemd when upgrading

· 52CE 我爱测

On our centos system we have configured a teamcity agent as a systemd service. The service works fine except when the agent performs an upgrade. Then it gets killed while performing the upgrade. I guess this is due to the fact, t…

问题原文

原帖链接 · Daniel Schröter · CC BY-SA 3.0

On our centos system we have configured a teamcity agent as a systemd service. The service works fine except when the agent performs an upgrade. Then it gets killed while performing the upgrade. I guess this is due to the fact, that systemd watches the created processes and when the main process exists to let a second process perform an upgrade systemd decides this is a lost process and kills it after about a minute.

I guess this assumption gets validated by the fact that when i directly start the teamcity agent the upgrade works without a problem.

This is the configuration of the service:

[Unit]
Description=teamcity agent - local
Requires=network.target
After=network.target

[Service]
Type=forking
PIDFile=/home/teamcityagent/logs/buildAgent.pid
WorkingDirectory=/home/teamcityagent
User=teamcityagent
Group=teamcityagent
ExecStart=/home/teamcityagent/bin/agent.sh start
ExecStop=/home/teamcityagent/bin/agent.sh stop
TimeoutStartSec=900
TimeoutStopSec=60

[Install]
WantedBy=multi-user.target

So far I have tried to change the timeout to 900secs and commented out the PIDFile. Nothing helped.

Is there a way to tell systemd to not kill the upgrade process by telling it not to watch for lost processes?

已采纳解答

原帖链接 · philwills · CC BY-SA 3.0

Adding

RemainAfterExit=yes

to the Service stanza appears to fix this without needing to change timeouts.

Documented at https://www.freedesktop.org/software/systemd/man/systemd.service.html#RemainAfterExit=

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2015-01-16)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。