I found this excellent website which gives an example upstart script for running Python scripts as daemons. My question is, can I change the name it reports as when I type ps -e?
我发现这个优秀的网站提供了一个示例新手脚本,用于运行Python脚本作为守护进程。我的问题是,当我输入ps -e时,我可以更改它报告的名称吗?
I was thinking start-stop-daemon might have an option to do that but I haven't found it.
我在想start-stop-daemon可能有选择这样做,但我还没有找到它。
1 个解决方案
#1
In pure python, there's no easy way to do it.
在纯python中,没有简单的方法可以做到这一点。
The setproctitle package, however, could prove useful. It allows a python process to set its process name. It's a C extension that has support for a number of operating systems, and supports both Python 2 and 3. It does appear that it may be unmaintained now, but it is still working well for me.
但是,setproctitle包可能会很有用。它允许python进程设置其进程名称。它是一个C扩展,支持许多操作系统,并支持Python 2和3.它看起来现在可能没有维护,但它仍然适用于我。
#1
In pure python, there's no easy way to do it.
在纯python中,没有简单的方法可以做到这一点。
The setproctitle package, however, could prove useful. It allows a python process to set its process name. It's a C extension that has support for a number of operating systems, and supports both Python 2 and 3. It does appear that it may be unmaintained now, but it is still working well for me.
但是,setproctitle包可能会很有用。它允许python进程设置其进程名称。它是一个C扩展,支持许多操作系统,并支持Python 2和3.它看起来现在可能没有维护,但它仍然适用于我。