Skip to content

Instantly share code, notes, and snippets.

@espacioAntonio
Last active September 11, 2017 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save espacioAntonio/2d2cbb3da1a64b84a2cbffb1eda76f3d to your computer and use it in GitHub Desktop.
Save espacioAntonio/2d2cbb3da1a64b84a2cbffb1eda76f3d to your computer and use it in GitHub Desktop.
change proccess name for a python program / script
import os
import ctypes
import platform
def set_name(new_name):
if platform.system()!='Linux':
print 'Unsupported platform'
try:
libc = ctypes.CDLL('libc.so.6')
libc.prctl(15,new_name,0,0,0)
return True
except:
print "PID: "+repr(os.getpid())
return False
def main():
set_name("New_Name.py")
if __name__ == "__main__":
main()
@espacioAntonio
Copy link
Author

change proccess name for a python program

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment