def daemonManagedByAutostart(self, on): if on: tryMkdir(os.path.dirname(constants.AUTOSTART_DESKTOP_USERFILE)) trySymlink(constants.AUTOSTART_DESKTOP_FILE, constants.AUTOSTART_DESKTOP_USERFILE) else: tryRemove(constants.AUTOSTART_DESKTOP_USERFILE)
def managedByAutostart(self, on): if on: tryMkdir(os.path.dirname(constants.AUTOSTART_DESKTOP_USERFILE)) trySymlink(constants.AUTOSTART_DESKTOP_FILE, constants.AUTOSTART_DESKTOP_USERFILE) else: tryRemove(constants.AUTOSTART_DESKTOP_USERFILE)
def autoStart(self, on): if on: # mkdir if autostart dir doesn't exist misc.tryMkdir(os.path.dirname(constants.DESKTOP_AUTOSTART_FILE)) misc.trySymlink(constants.DESKTOP_FILE, constants.DESKTOP_AUTOSTART_FILE) else: misc.tryRemove(constants.DESKTOP_AUTOSTART_FILE)
def listenerThread(self): # clean if previous run crashes tryRemove(constants.FRONTEND_SOCKET[0]) with Listener(*constants.FRONTEND_SOCKET) as listener: while True: with listener.accept() as conn: payload = conn.recv() self.agent.createTasksAction(payload)
def daemonManagedByUpstart(self, on): if on: tryMkdir(os.path.dirname(constants.UPSTART_SERVICE_USERFILE)) trySymlink(constants.UPSTART_SERVICE_FILE, constants.UPSTART_SERVICE_USERFILE) else: tryRemove(constants.UPSTART_SERVICE_USERFILE) if getInitType() == InitType.UPSTART: os.system("initctl --user reload-configuration")
def managedByUpstart(self, on): if on: tryMkdir(os.path.dirname(constants.UPSTART_SERVICE_USERFILE)) trySymlink(constants.UPSTART_SERVICE_FILE, constants.UPSTART_SERVICE_USERFILE) else: tryRemove(constants.UPSTART_SERVICE_USERFILE) if getInitType() == InitType.UPSTART: os.system("initctl --user reload-configuration")
def daemonManagedBySystemd(self, on): if on: tryMkdir(os.path.dirname(constants.SYSTEMD_SERVICE_ENABLED_USERFILE)) trySymlink(constants.SYSTEMD_SERVICE_FILE, constants.SYSTEMD_SERVICE_USERFILE) trySymlink(constants.SYSTEMD_SERVICE_USERFILE, constants.SYSTEMD_SERVICE_ENABLED_USERFILE) else: tryRemove(constants.SYSTEMD_SERVICE_ENABLED_USERFILE) tryRemove(constants.SYSTEMD_SERVICE_USERFILE) if getInitType() == InitType.SYSTEMD: os.system("systemctl --user daemon-reload")
def managedBySystemd(self, on): if on: tryMkdir(os.path.dirname(constants.SYSTEMD_SERVICE_ENABLED_USERFILE)) trySymlink(constants.SYSTEMD_SERVICE_FILE, constants.SYSTEMD_SERVICE_USERFILE) trySymlink(constants.SYSTEMD_SERVICE_USERFILE, constants.SYSTEMD_SERVICE_ENABLED_USERFILE) else: tryRemove(constants.SYSTEMD_SERVICE_ENABLED_USERFILE) tryRemove(constants.SYSTEMD_SERVICE_USERFILE) if getInitType() == InitType.SYSTEMD: os.system("systemctl --user daemon-reload")