使用主管(Linux)在关机期间保持程序最后运行

时间:2021-03-15 14:56:39

I have a server with supervisor which runs two programs. Let's call them Program A and Program B. When the server gets shutdown. Program A's execution is terminated before Program B, which results in errors before the shutdown is completed. Is there a way using Supervisor to ensure that Program A will never be stopped before Program B is? It would actually not matter if Program A was not getting the SIGTERM so that it could ignore it all together (and keep running until after Program B has been shut down.)

我有一个带有主管的服务器,它运行两个程序。我们称之为程序A和程序B.当服务器关闭时。程序A的执行在程序B之前终止,这在关闭完成之前导致错误。有没有办法使用Supervisor确保程序A永远不会在程序B之前停止?如果程序A没有获得SIGTERM以便它可以一起忽略它(并且一直运行直到程序B关闭之后),这实际上并不重要。

Thank you,

1 个解决方案

#1


1  

See supervisord doc about parameter setting up priority

有关参数设置优先级,请参阅supervisord doc

The doc states:

该文件指出:

priority: The relative priority of the program in the start and shutdown ordering. Lower priorities indicate programs that start first and shut down last at startup and when aggregate commands are used in various clients (e.g. “start all”/”stop all”). Higher priorities indicate programs that start last and shut down first.

priority:程序在启动和关闭顺序中的相对优先级。较低的优先级表示在启动时最后启动并且最后关闭的程序以及在各种客户端中使用聚合命令的程序(例如“全部启动”/“全部停止”)。优先级越高表示程序最后启动并首先关闭。

Default: 999

Required: No.

Introduced: 3.0

#1


1  

See supervisord doc about parameter setting up priority

有关参数设置优先级,请参阅supervisord doc

The doc states:

该文件指出:

priority: The relative priority of the program in the start and shutdown ordering. Lower priorities indicate programs that start first and shut down last at startup and when aggregate commands are used in various clients (e.g. “start all”/”stop all”). Higher priorities indicate programs that start last and shut down first.

priority:程序在启动和关闭顺序中的相对优先级。较低的优先级表示在启动时最后启动并且最后关闭的程序以及在各种客户端中使用聚合命令的程序(例如“全部启动”/“全部停止”)。优先级越高表示程序最后启动并首先关闭。

Default: 999

Required: No.

Introduced: 3.0