我想配置码头容器的logrotate。我在Docker容器中运行httpd作为后台进程,在logrotate之后,我需要重新加载它以使用新的日志文件。由于可能的停机时间,我不想重启容器。发送SIGHUP docker kill --signal=HUP <container>
不起作用,因为我的入口点是不处理信号的bash脚本。我试图做这样的logrotate设置:Logrotate postrotate和码头执行器奇怪的行为
...
sharedscripts
postrotate
service httpd reload > /dev/null 2>/dev/null || true
docker exec some-container kill -HUP $(ps -e | awk '{print $1}')>>/tmp/exec-out.log 2>>/tmp/exec-out.log || true
endscript
,但我得到了
kill: sending signal to 30 failed: No such process
kill: sending signal to 31 failed: No such process
kill: sending signal to 32 failed: No such process
kill: sending signal to 33 failed: No such process
kill: sending signal to 34 failed: No such process
kill: sending signal to 35 failed: No such process
kill: sending signal to 36 failed: No such process
kill: sending signal to 37 failed: No such process
kill: sending signal to 38 failed: No such process
我是很新的泊坞窗和Linux,我真的不明白,为什么泊坞窗获取进程ID是不存在。
编辑:我也不想改变bash脚本来捕捉SIGHUP,如果可能的话,而是在logrotate配置中解决问题。