From 550159216a4c63f4ee3351f26310ec3bbf4e4d53 Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Fri, 9 Nov 2012 21:30:41 +0100 Subject: Start script now checks if Python 3 is the default installation on the system. If not the script tries to launch pyAggr3g470r with Python 3.2. --- source/pyAggr3g470r | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'source/pyAggr3g470r') diff --git a/source/pyAggr3g470r b/source/pyAggr3g470r index 5bce5181..f9177374 100755 --- a/source/pyAggr3g470r +++ b/source/pyAggr3g470r @@ -37,10 +37,10 @@ import signal PATH = os.path.abspath(".") SERVICE = "pyAggr3g470r" -def service_start(servicename = None): +def service_start(python_command, servicename = None): if servicename is not None: service = servicename + ".py" - proc = subprocess.Popen(["python",service], stderr=subprocess.STDOUT, stdout=subprocess.PIPE) + proc = subprocess.Popen([python_command, service], stderr=subprocess.STDOUT, stdout=subprocess.PIPE) time.sleep(0.15) return proc.pid return False @@ -80,9 +80,9 @@ def rmpid (processname = None): else: return False -def start(): +def start(python_command): if not checkpid(servicename = SERVICE): - pid = service_start(servicename = SERVICE) + pid = service_start(python_command, servicename = SERVICE) writepid(processname = SERVICE, pid = pid) print(SERVICE + " is starting with pid: " + pidof(processname=SERVICE)) else: @@ -117,14 +117,17 @@ def usage(): if __name__ == "__main__": # Point of entry in execution mode. + python_command = "python" + if sys.version_info.major == 2: + python_command = "python3.2" if len(sys.argv) == 1: usage() elif sys.argv[1] == "start": - start() + start(python_command) elif sys.argv[1] == "stop": stop() elif sys.argv[1] == "restart": stop() - start() + start(python_command) else: usage() -- cgit