aboutsummaryrefslogtreecommitdiff
path: root/source/pyAggr3g470r
diff options
context:
space:
mode:
Diffstat (limited to 'source/pyAggr3g470r')
-rwxr-xr-xsource/pyAggr3g470r18
1 files changed, 12 insertions, 6 deletions
diff --git a/source/pyAggr3g470r b/source/pyAggr3g470r
index 331dac05..3ea48933 100755
--- a/source/pyAggr3g470r
+++ b/source/pyAggr3g470r
@@ -38,6 +38,9 @@ PATH = os.path.abspath(".")
SERVICE = "pyAggr3g470r"
def service_start(python_command, servicename = None):
+ """
+ Starts a new service with Popen and returns the processus id.
+ """
if servicename is not None:
service = servicename + ".py"
proc = subprocess.Popen([python_command, "-tt", service], stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
@@ -45,10 +48,13 @@ def service_start(python_command, servicename = None):
return proc.pid
return False
-def writepid (processname = None, pid = None):
- pidpath = os.path.join(PATH,"var",processname+".pid")
+def writepid(processname = None, pid = None):
+ """
+ Writes the pid of processname in a file.
+ """
+ pidpath = os.path.join(PATH, "var", processname + ".pid")
if processname is not None and pid is not None:
- f = open (pidpath,"w")
+ f = open (pidpath, "w")
f.write(str(pid))
f.close()
return True
@@ -56,14 +62,14 @@ def writepid (processname = None, pid = None):
return False
def checkpid (servicename = None):
- pidpath = os.path.join(PATH,"var",servicename+".pid")
+ pidpath = os.path.join(PATH,"var", servicename + ".pid")
if os.path.exists(pidpath):
return True
else:
return False
def pidof(processname = None):
- pidpath = os.path.join(PATH,"var",processname+".pid")
+ pidpath = os.path.join(PATH, "var", processname + ".pid")
if processname is not None and os.path.exists(pidpath):
f = open (pidpath)
pid = f.read()
@@ -131,4 +137,4 @@ if __name__ == "__main__":
stop()
start(python_command)
else:
- usage()
+ usage() \ No newline at end of file
bgstack15