diff --git a/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java b/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java index a48a1de455..c2f4feb988 100644 --- a/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java +++ b/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java @@ -499,11 +499,6 @@ public class RunNiFi { final Properties nifiProps = loadProperties(logger); final String secretKey = nifiProps.getProperty("secret.key"); - final File statusFile = getStatusFile(logger); - if (statusFile.exists() && !statusFile.delete()) { - logger.error("Failed to delete status file {}; this file should be cleaned up manually", statusFile); - } - try (final Socket socket = new Socket()) { logger.debug("Connecting to NiFi instance"); socket.setSoTimeout(60000); @@ -568,6 +563,10 @@ public class RunNiFi { } } + final File statusFile = getStatusFile(logger); + if (statusFile.exists() && !statusFile.delete()) { + logger.error("Failed to delete status file {}; this file should be cleaned up manually", statusFile); + } logger.info("NiFi has finished shutting down."); } } else {