Script execution

This commit is contained in:
sfop
2017-04-03 11:17:02 +02:00
parent eff4d94287
commit 7aa8e161e1

View File

@@ -311,10 +311,15 @@ def _get_camtool_port():
return camtool.url[camtool.url.rfind(":")+1:]
def is_camtool_running():
"""
"""
return int(exec_cmd("pgrep " + CAMTOOL_SERVER_SCRIPT + " | wc -l")) > 0
#return int(exec_cmd('pgrep -f "' + CAMTOOL_SERVER_SCRIPT + ' -p ' + _get_camtool_port() + '" | wc -l')) > 0
def kill_camtool():
"""
Kill the private camtool instance and child pocesses
"""
#return exec_cmd("killall -9 " + CAMTOOL_SERVER_SCRIPT)
return exec_cmd('pkill -f " \-p ' + _get_camtool_port() + '"')
@@ -328,6 +333,9 @@ def _run_camtool():
print >> sys.stderr, traceback.format_exc()
def check_camtool():
"""
Checks if private camtool server is running, otherwise starts it.
"""
if is_camtool_running():
return False
fork(_run_camtool)