(self, running)
Write my PID in two files in /run/ or remove the file if not running
Write my PID in two files in /run/ or remove the file if not running
Write my PID in two files in / run / or remove the file if not running
def setRunning(self, running):
        """Write my PID in two files in /run/ or remove the file if not running"""
        if running == True:
            import psutil
            with open(self.runFilePath, 'w') as runFile:
                runFile.write(str(os.getpid()))
            with open(self.globalRunFilePath, 'w') as runFile:
                runFile.write(str(os.getpid()))
        else:
            if os.path.isfile(self.runFilePath):
                os.remove(self.runFilePath)
            if os.path.isfile(self.globalRunFilePath):
                os.remove(self.globalRunFilePath)
def setRunning ( self , running ) : if running == True : import psutil with open ( self . runFilePath , 'w' ) as runFile : runFile . write ( str ( os . getpid ( ) ) ) with open ( self . globalRunFilePath , 'w' ) as runFile : runFile . write ( str ( os . getpid ( ) ) ) else : if os . path . isfile ( self . runFilePath ) : os . remove ( self . runFilePath ) if os . path . isfile ( self . globalRunFilePath ) : os . remove ( self . globalRunFilePath )