net/keepalived: add procd_add_reload_trigger
Do service reload handling by procd. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
parent
455d9a5b48
commit
0e88bff102
1 changed files with 5 additions and 22 deletions
|
@ -404,31 +404,14 @@ process_config() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
service_running() {
|
service_triggers() {
|
||||||
pgrep -x /usr/sbin/keepalived &> /dev/null
|
procd_add_reload_trigger "keepalived"
|
||||||
}
|
|
||||||
|
|
||||||
conf_md5() {
|
|
||||||
echo "$(md5sum $KEEPALIVED_CONF | awk '{print $1}')"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reload_service() {
|
reload_service() {
|
||||||
local cur_md5="$(conf_md5)"
|
process_config
|
||||||
running && {
|
#SIGHUP is used by keepalived to do init.d reload
|
||||||
process_config
|
procd_send_signal keepalived
|
||||||
|
|
||||||
# Return without performing the reload if config
|
|
||||||
# file md5sum has not changed
|
|
||||||
local new_md5="$(conf_md5)"
|
|
||||||
[ "$new_md5" == "$cur_md5" ] && return 0;
|
|
||||||
|
|
||||||
# SIGHUP is used by keepalived to do init.d reload
|
|
||||||
# Get the oldest process (assumption is that it's the parent process)
|
|
||||||
PID=$(pgrep -o /usr/sbin/keepalived)
|
|
||||||
kill -SIGHUP $PID
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
return 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
start_service() {
|
start_service() {
|
||||||
|
|
Loading…
Reference in a new issue