diff options
-rw-r--r-- | setup/default.xml | 1 | ||||
-rw-r--r-- | src/main/java/org/traccar/api/HealthCheckService.java | 3 | ||||
-rw-r--r-- | src/main/java/org/traccar/config/Keys.java | 6 |
3 files changed, 8 insertions, 2 deletions
diff --git a/setup/default.xml b/setup/default.xml index 7e1572530..e05aa52d6 100644 --- a/setup/default.xml +++ b/setup/default.xml @@ -14,7 +14,6 @@ <entry key='web.port'>8082</entry> <entry key='web.path'>./web</entry> <entry key='web.cacheControl'>max-age=3600,public</entry> - <entry key='web.healthCheck'>true</entry> <entry key='geocoder.enable'>false</entry> <entry key='geocoder.type'>google</entry> diff --git a/src/main/java/org/traccar/api/HealthCheckService.java b/src/main/java/org/traccar/api/HealthCheckService.java index 1e8f0d731..c9ce5a6c9 100644 --- a/src/main/java/org/traccar/api/HealthCheckService.java +++ b/src/main/java/org/traccar/api/HealthCheckService.java @@ -20,6 +20,7 @@ import com.sun.jna.Native; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.traccar.Context; +import org.traccar.config.Keys; import java.util.TimerTask; @@ -33,7 +34,7 @@ public class HealthCheckService { private long period; public HealthCheckService() { - if (Context.getConfig().getBoolean("web.healthCheck") + if (!Context.getConfig().getBoolean(Keys.WEB_DISABLE_HEALTH_CHECK) && System.getProperty("os.name").toLowerCase().startsWith("linux")) { try { systemD = Native.load("systemd", SystemD.class); diff --git a/src/main/java/org/traccar/config/Keys.java b/src/main/java/org/traccar/config/Keys.java index 441898feb..fb32857d8 100644 --- a/src/main/java/org/traccar/config/Keys.java +++ b/src/main/java/org/traccar/config/Keys.java @@ -423,6 +423,12 @@ public final class Keys { public static final ConfigKey WEB_REQUEST_LOG_RETAIN_DAYS = new ConfigKey( "web.requestLog.retainDays", Integer.class); + /** + * Disable systemd health checks. + */ + public static final ConfigKey WEB_DISABLE_HEALTH_CHECK = new ConfigKey( + "web.disableHealthCheck", Boolean.class); + private Keys() { } |