Differences between revisions 3 and 4
Revision 3 as of 2009-11-28 14:48:32
Size: 956
Editor: Elias
Comment: 删除对PageComment2组件的引用
Revision 4 as of 2009-12-25 07:17:59
Size: 958
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
::-- ZoomQuiet [[[DateTime(2008-02-29T03:47:07Z)]]]
[[TableOfContents]]
::-- ZoomQuiet [<<DateTime(2008-02-29T03:47:07Z)>>]
<<TableOfContents>>
Line 8: Line 8:
[[Include(CPUGnav)]] <<Include(CPUGnav)>>
Line 16: Line 16:
subject [CPyUG:41663] Re: [http://groups.google.com/group/python-cn/browse_thread/thread/74e232c3d5dc7d78/353464f2731c5ddd 如何改变python脚本的进程名?] subject [CPyUG:41663] Re: [[http://groups.google.com/group/python-cn/browse_thread/thread/74e232c3d5dc7d78/353464f2731c5ddd|如何改变python脚本的进程名?]]

::-- ZoomQuiet [2008-02-29 03:47:07]

CPUG联盟::

CPUG::门户plone

BPUG

SPUG

ZPUG

SpreadPython Python宣传

1. 自定Py脚本运行进程名

{{{沈崴 <[email protected]> reply-to [email protected], to "python-cn:CPyUG" <[email protected]>, date Fri, Feb 29, 2008 at 9:27 AM }}} subject [CPyUG:41663] Re: 如何改变python脚本的进程名?

   1 #!/usr/bin/env python
   2 procname = 'Hello'
   3 
   4 import os, sys
   5 if not os.environ.has_key('NEWPROCNAME'):
   6        os.execlpe(sys.executable, procname, __file__, {'NEWPROCNAME':
   7 procname})
   8 
   9 import dl
  10 libc = dl.open('/lib/libc.so.6')
  11 libc.call('prctl', 15, '%s\0' %procname, 0, 0, 0)
  12 # BSD
  13 # libc.call('setproctitle', '%s\0' %procname)

MiscItems/2008-02-29 (last edited 2009-12-25 07:17:59 by localhost)