开发者

how to specify the name of my daemon process using pydaemon

开发者 https://www.devze.com 2023-04-05 03:10 出处:网络
I\'m using pydaemon ( http://www.python.org/dev/peps/pep-3143/ ) to make a friendly daemon. How do I give it a name? by default it\'s called \'python\' but I wa开发者_运维百科nt something more meaning

I'm using pydaemon ( http://www.python.org/dev/peps/pep-3143/ ) to make a friendly daemon. How do I give it a name? by default it's called 'python' but I wa开发者_运维百科nt something more meaningful.


Changing the process name cannot be done from plain Python, and pydaemon is 100% Python. You need a C-level library like py-setproctitle to do that. Then, simply add the following to your main method:

try:
  import setproctitle
  setproctitle.setproctitle('my-awesome-program')
except:
  pass # Ignore errors, since this is only cosmetic
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号