keepalived: add option to override service running check

Some init.d scripts like firewall and sqm do not return the actual state
of the service if called with "running" parameter. This result in the
init script called with "start" parameter and the service may not load
the new configuration. Firewall init script is one of this
An option is added in order to skip the "running" check for the service.

Signed-off-by: Francesco Benini <francy.benini@gmail.com>
pull/25188/head
Francesco Benini 2024-10-20 00:36:07 +02:00 committed by Florian Eckert
parent b37e625c22
commit ea092363d9
3 changed files with 18 additions and 5 deletions

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=keepalived
PKG_VERSION:=2.2.8
PKG_RELEASE:=7
PKG_RELEASE:=8
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.keepalived.org/software

View File

@ -5,6 +5,7 @@
set_service_name firewall
set_skip_running_check
set_reload_if_sync
add_sync_file /etc/config/firewall

View File

@ -31,17 +31,17 @@ _service() {
[ ! -x "$rc" ] && return
case $1 in
start) $rc running || $rc start ;;
stop) $rc running && $rc stop ;;
start) _service_running_check "$rc" || $rc start ;;
stop) _service_running_check "$rc" && $rc stop ;;
reload)
if $rc running; then
if _service_running_check "$rc"; then
$rc reload
else
$rc start
fi
;;
restart)
if $rc running; then
if _service_running_check "$rc"; then
$rc restart
else
$rc start
@ -50,6 +50,10 @@ _service() {
esac
}
_service_running_check() {
skip_running_check || "$1" running
}
_start_service() {
_service start
}
@ -158,6 +162,14 @@ backup_and_stop() {
get_var_flag NOTIFY_BACKUP_STOP 1
}
set_skip_running_check() {
set_var NOTIFY_SKIP_RUNNING 1
}
skip_running_check() {
get_var_flag NOTIFY_SKIP_RUNNING
}
set_reload_if_sync() {
set_var NOTIFY_SYNC_RELOAD "${1:-1}"
}