Differences between revisions 2 and 3
Revision 2 as of 2008-04-09 06:16:38
Size: 1010
Editor: ZoomQuiet
Comment:
Revision 3 as of 2009-11-28 14:48:32
Size: 956
Editor: Elias
Comment: 删除对PageComment2组件的引用
Deletions are marked like this. Additions are marked like this.
Line 36: Line 36:
[[PageComment2]] [:/PageCommentData:PageCommentData]

::-- ZoomQuiet [DateTime(2008-02-29T03:47:07Z)] TableOfContents

Include(CPUGnav)

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: [http://groups.google.com/group/python-cn/browse_thread/thread/74e232c3d5dc7d78/353464f2731c5ddd 如何改变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)