aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-02-17 07:56:32 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-02-17 07:56:32 +0100
commit352dae6afd4178c090473dbfe8c1d3f7209507f0 (patch)
treeff9e6f71d7748f4447db45cd7003c6ac5b5478cd /source
parentUpdated comments. (diff)
downloadnewspipe-352dae6afd4178c090473dbfe8c1d3f7209507f0.tar.gz
newspipe-352dae6afd4178c090473dbfe8c1d3f7209507f0.tar.bz2
newspipe-352dae6afd4178c090473dbfe8c1d3f7209507f0.zip
Updated comments.
Diffstat (limited to 'source')
-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