如何在Docker中重新启动tcserver实例?
我使用docker来创build一个tcserver实例,当我这样做的时候它已经成功停止
./tcruntime-ctl.sh停止
但是,实例没有成功重新启动
./tcruntime-ctl.sh运行
原因是PID文件(PID = 1)仍然存在,没有被删除
请注意,我使用run命令将tcserver实例作为前台进程运行
如果错误仅仅是上一次运行时存在tcruntime-ctl.sh
pidfile,则解决方法是在调用tcruntime-ctl.sh
脚本之前删除pidfile。 由于tcServer实例的生命周期与docker容器的生命周期相关,因此可以安全地假定pidfile中引用的进程已经退出。 您可以编写自己的脚本,在exec
tcruntime.sh
之前清理tcruntime.sh
,也可以预先设置如下内容:
#!/bin/sh pidfile=$(dirname $0)/../logs/tcserver.pid if [ -f $pidfile ] ; then rm $pidfile fi