diff --git a/inventory/README.md b/inventory/README.md index ec77fbcde9..0eb1160cc0 100644 --- a/inventory/README.md +++ b/inventory/README.md @@ -27,11 +27,13 @@ And then run: To configure it with custom parameters append optional program arguments in the following order: -Arguments: `port cleanupTorFiles intervalSec useLocalhostForP2P network` +Arguments: `port cleanupTorFiles intervalSec shutdownIntervalDays useLocalhostForP2P network` +If `shutdownIntervalDays` is 0 the app will not be shut down. Otherwise, it's the number of days for shutting down (run +script need to ensure the node gets started again). -Values: `Integer 0|1 Integer 0|1 BTC_MAINNET|BTC_TESTNET|BTC_REGTEST` +Values: `Integer 0|1 Integer Integer 0|1 BTC_MAINNET|BTC_TESTNET|BTC_REGTEST` -Example for localhost, regtest on port 8080: `8080 0 10 1 BTC_REGTEST` +Example for localhost, regtest on port 8080: `8080 0 10 5 1 BTC_REGTEST` Example for production node with cleanupTorFiles=true: `80 1` diff --git a/inventory/src/main/java/bisq/inventory/InventoryMonitorMain.java b/inventory/src/main/java/bisq/inventory/InventoryMonitorMain.java index 23231919d0..6750349ac1 100644 --- a/inventory/src/main/java/bisq/inventory/InventoryMonitorMain.java +++ b/inventory/src/main/java/bisq/inventory/InventoryMonitorMain.java @@ -52,12 +52,13 @@ public class InventoryMonitorMain { private static boolean stopped; // Example prog args: - // 8080 0 10 1 BTC_REGTEST + // 8080 0 10 5 1 BTC_REGTEST public static void main(String[] args) { // Default values int port = 80; boolean cleanupTorFiles = false; int intervalSec = 120; + int shutdownIntervalDays = 5; boolean useLocalhostForP2P = false; BaseCurrencyNetwork network = BaseCurrencyNetwork.BTC_MAINNET; @@ -75,10 +76,13 @@ public class InventoryMonitorMain { intervalSec = Integer.parseInt(args[2]); } if (args.length > 3) { - useLocalhostForP2P = args[3].equals("1"); + shutdownIntervalDays = Integer.parseInt(args[3]); } if (args.length > 4) { - network = BaseCurrencyNetwork.valueOf(args[4]); + useLocalhostForP2P = args[4].equals("1"); + } + if (args.length > 5) { + network = BaseCurrencyNetwork.valueOf(args[5]); } String appName = "bisq-inventory-monitor-" + network; @@ -93,7 +97,9 @@ public class InventoryMonitorMain { inventoryMonitor.start(port); // We shut down after 5 days to avoid potential memory leak issue. // The start script will restart the app. - UserThread.runAfter(InventoryMonitorMain::shutDown, TimeUnit.DAYS.toSeconds(5)); + if (shutdownIntervalDays > 0) { + UserThread.runAfter(InventoryMonitorMain::shutDown, TimeUnit.DAYS.toSeconds(shutdownIntervalDays)); + } keepRunning(); }