Ejemplo n.º 1
0
    def __is_sync_active(self):
        """
        returns true when the sync is active
        """
  
        # get lock path
        path = self.__get_lockfile_path();
  
        # check if path exists        
        result = self.__file_system.path_exists(path)
        if result == False:
            return result
        
        
        # read pid from file
        old_pid = None 
        pid_file = open(path, "r")
        
        for line in pid_file.readlines():
            old_pid = line

        # close pid file
        pid_file.close()
        
        if old_pid is None or old_pid == "":
            # empty file remove
            self.__file_system.remove_file(path)
            return False
        
        # check if the pid still exists
        return PidHelper.pid_exists(old_pid)