RosettaCodeData/Task/Determine-if-only-one-instance-is-running/Python/determine-if-only-one-instance-is-running.py
Ingy döt Net 764da6cbbb CDE
2013-04-10 16:57:12 -07:00

8 lines
339 B
Python

import __main__, os
def isOnlyInstance():
# Determine if there are more than the current instance of the application
# running at the current time.
return os.system("(( $(ps -ef | grep python | grep '[" +
__main__.__file__[0] + "]" + __main__.__file__[1:] +
"' | wc -l) > 1 ))") != 0