Last active
September 11, 2017 22:07
-
-
Save espacioAntonio/2d2cbb3da1a64b84a2cbffb1eda76f3d to your computer and use it in GitHub Desktop.
change proccess name for a python program / script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
change proccess name for a python program