我的服务是一组“多个”守护进程。 我需要把它与新贵整合起来才能在启动时启动。 问题是,当任何守护进程突然死亡时,我需要重新启动服务。 我可以用一个.conf脚本来做吗,还是我需要多个.conf脚本来做这个。 请build议。 在此先感谢,-rk
如果所有的守护进程都可以很好地与“重生”SIGTERM搭配,那么你可以将它们合并到一个包装脚本中。 从新贵Respawning :
One situation where it may seem like respawn should be avoided, is when a daemon doesn't respond well to SIGTERM for stopping it. You may believe that you need to send the service its shutdown command without upstart being involved, and therefore, you don't want to use respawn because upstart will keep trying to start your service back up when you told it to shutdown.
However, the appopriate way to handle that situation is a pre-stop which runs this shutdown command. Since the job's goal will already be 'stop' when a pre-stop is run, you can shutdown the process through any means, and the process won't be respawned (even with the respawn stanza).