Commit a64aa046 authored by Marco Buttu's avatar Marco Buttu
Browse files

Fixed a bug (pid check)

parent 4fbf342f
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -9,11 +9,15 @@ from math import degrees
from Acspy.Clients.SimpleClient import PySimpleClient
from Acspy.Util.ACSCorba import getManager

# Exit in case the process is already running
process = os.path.basename(__file__)
running_processes = os.popen("ps aux").read()
counter = 0
for line in running_processes.split('\n'):
    if 'ACSSW/bin/python' in line and process in line:
    if 'python' in line and process in line:
        if str(os.getpid()) in line.split():
            continue
        else:
            counter += 1
    if counter > 1:
        print '%s already running, everything is OK' % process