/** * executes a shell script at "scriptPath". If runningFilePath is not blank and not null, then * Mesquite will create a file there that will serve as a flag to Mesquite that the script is * running. */ public boolean executeInShell() { proc = null; try { ShellScriptUtil.setScriptFileToBeExecutable(scriptPath); if (!StringUtil.blank(runningFilePath)) { if (StringUtil.blank(runningFileMessage)) MesquiteFile.putFileContents(runningFilePath, "Script running...", true); else MesquiteFile.putFileContents(runningFilePath, runningFileMessage, true); if (appendRemoveCommand && MesquiteFile.fileExists(runningFilePath)) MesquiteFile.appendFileContents( scriptPath, StringUtil.lineEnding() + ShellScriptUtil.getRemoveCommand(runningFilePath), true); // append remove command to guarantee that the runningFile is deleted // +StringUtil.lineEnding()+ShellScriptUtil.getExitCommand() } proc = ShellScriptUtil.executeScript(scriptPath, visibleTerminal); } catch (IOException e) { MesquiteMessage.warnProgrammer("IOException in shell script executed by " + name); return false; } return true; }