ubuntu upstart 用于具有多个守护进程的服务

ubuntu upstart 用于具有多个守护进程的服务

我的服务是一组“多个”守护进程。我需要将其与 upstart 集成,以便在启动期间启动。问题是当任何守护进程突然死亡时,我需要重新启动服务。我可以用一个 .conf 脚本来完成它吗?还是我需要多个 .conf 脚本来完成此操作。请指教。提前致谢,-rk

答案1

如果你的所有守护进程都能很好地处理“respawn”SIGTERM,那么你可以将它们合并到一个包装脚本中。从新贵重生

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).

相关内容