On Eurotech gateways, ESF startup and shutdown is managed by systemd.
ESF RPM installs a
kura.service systemd unit that allows to start and stop ESF. The unit is enabled by default by ESF RPM install scripts, and for this reason ESF will start automatically on boot.
ESF can also be started and stopped manually using the command line with the following commands:
systemctl start kura
systemctl stop kura
Starting from ESF 7.0.0, ESF shutdown is initiated by the stop script by creating a file named
stop in the
/run/kura-shutdown directory, monitored by ESF. This operation can be performed only by a privileged user. When ESF shutdown completes, ESF will create a file named
stopped in the same directory.
It is not recommended to use the
/run/kura-shutdown directory directly, ESF should be stopped using the
systemctl stop kura command instead.
ESF stop script has a 30 seconds timeout by default, if the framework takes more than 30 seconds to stop, then the stop script will exit and the JVM will be terminated by systemd.
The stop script timeout can be configured by setting the
kura.shutdown.timeout property in the
/opt/eurotech/esf/user/kura_custom.properties to the desired value in seconds, setting 0 as value will disable stop script timeout.
In any case ESF shutdown is subject to systemd stop timeout, witch is set to 5 minutes by default. Even if the stop timeout is increased using the
kura.shutdown.timeout property, ESF will be terminated by systemd if it takes more that 5 minutes to stop.
Increasing the stop timeout can be useful for the cases when some application/ESF component needs to perform important cleanup operations on shutdown. One example of this can be the usage of an H2Db Service instance that manages a persisted database, in this case increasing the stop timeout can be useful to ensure that the database is closed cleanly.
In any case, if the stop timeout is increased, it is recommended to observe and review the framework shutdown behavior during application development.
Updated 3 months ago