Exemple #1
0
    def __init__(self):
        # Create config dir, if not existing
        self.queueFolder = create_config_dir()
        self.logDir = create_log_dir()
        self.config = get_config()

        remove_old_logs(self.config['log']['logTime'], self.logDir)
        self.read_queue()
        # Load previous queue
        # Reset queue if all jobs from last session are finished
        if self.get_next_item() is None:
            # Rotate old log
            self.log(rotate=True)
            self.queue = {}
            # Remove old log file
            self.log()
            self.write_queue()
        self.socket = create_daemon_socket()

        # If there are still jobs in the queue the daemon might pause,
        # if this behaviour is defined in the config file.
        # The old logfile is beeing loaded as well.
        self.paused = False
        if len(self.queue) > 0:
            self.nextKey = max(self.queue.keys()) + 1
            if not self.config['default']['resumeAfterStart']:
                self.paused = True
        else:
            self.nextKey = 0

        self.active = True
        self.stopping = False
        self.reset = False
        self.remove_current = False

        # Variables to get the current state of a process
        self.processStatus = 'No running process'

        # Variables for handling sockets and child process
        self.clientAddress = None
        self.clientSocket = None
        self.process = None
        self.read_list = [self.socket]

        # Stdout/Stderr management
        self.stdout = get_stdout_descriptor()
        self.stderr = get_stderr_descriptor()
Exemple #2
0
def execute_log(args):
    logPath = create_log_dir() + '/queue.log'
    logFile = open(logPath, 'r')
    print(logFile.read())