public DaemonOperation(DaemonOperationOptions options) { super(null); this.options = options; this.pidFile = new File(UserConfig.getUserConfigDir(), PID_FILE); }
public void enterLoop() throws IOException, ServiceAlreadyStartedException { File userAppDir = UserConfig.getUserConfigDir(); userAppDir.mkdirs(); controlFile.delete(); controlFile.createNewFile(); controlFile.deleteOnExit(); logger.log(Level.INFO, "Monitoring control file for commands at " + controlFile + " ..."); logger.log(Level.INFO, " (Note: This is a blocking operation. The 'main' thread is now blocked until '" + ControlCommand.SHUTDOWN + "' is received.)"); controlFileTailer.run(); // This blocks! }
public ControlServer() { this.controlFile = new File(UserConfig.getUserConfigDir(), CONTROL_FILE); this.controlFileTailer = new Tailer(controlFile, this, 1000, true); this.eventBus = LocalEventBus.getInstance(); }
File purgefilePath = new File(UserConfig.getUserConfigDir(), PURGEFILE_FILENAME);
File updatefilePath = new File(UserConfig.getUserConfigDir(), UPDATE_FILENAME);
private int runCommand(Command command, String commandName, String[] commandArgs) { File portFile = null; if (config != null) { portFile = config.getPortFile(); } File daemonPidFile = new File(UserConfig.getUserConfigDir(), DaemonOperation.PID_FILE); boolean localDirHandledInDaemonScope = portFile != null && portFile.exists(); boolean daemonRunning = PidFileUtil.isProcessRunning(daemonPidFile); boolean needsToRunInInitializedScope = command.getRequiredCommandScope() == CommandScope.INITIALIZED_LOCALDIR; boolean sendToRest = daemonRunning & localDirHandledInDaemonScope && needsToRunInInitializedScope; command.setOut(out); if (sendToRest) { if (command.canExecuteInDaemonScope()) { return sendToRest(command, commandName, commandArgs, portFile); } else { logger.log(Level.SEVERE, "Command not allowed when folder is daemon-managed: " + command.toString()); return showErrorAndExit("Command not allowed when folder is daemon-managed"); } } else { return runLocally(command, commandArgs); } }
public static boolean removeFolder(String localDirIdentifier) throws ConfigException { File daemonConfigFile = new File(UserConfig.getUserConfigDir(), UserConfig.DAEMON_FILE);
File daemonConfigFile = new File(UserConfig.getUserConfigDir(), UserConfig.DAEMON_FILE);
private void loadOrCreateConfig() { try { File daemonConfigFile = new File(UserConfig.getUserConfigDir(), UserConfig.DAEMON_FILE); File daemonConfigFileExample = new File(UserConfig.getUserConfigDir(), UserConfig.DAEMON_EXAMPLE_FILE);