From a49eca1d4d9da0c2834ea6471d8bec9bf63a5dfd Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Sat, 11 Nov 2017 21:42:46 +0100 Subject: community/keepalived: improve runscript, run with --dont-fork --- community/keepalived/APKBUILD | 8 +++--- community/keepalived/always-use-pid-dir.patch | 17 +++++++++++++ community/keepalived/keepalived.confd | 15 +++++++++-- community/keepalived/keepalived.initd | 36 ++++++++++++++++++++++----- 4 files changed, 65 insertions(+), 11 deletions(-) create mode 100644 community/keepalived/always-use-pid-dir.patch (limited to 'community/keepalived') diff --git a/community/keepalived/APKBUILD b/community/keepalived/APKBUILD index ad68787102..7be54a19bd 100644 --- a/community/keepalived/APKBUILD +++ b/community/keepalived/APKBUILD @@ -3,7 +3,7 @@ # Maintainer: Natanael Copa pkgname=keepalived pkgver=1.3.9 -pkgrel=1 +pkgrel=2 pkgdesc="Health Checking for Linux Virtual Server & High-Availability" url="http://www.keepalived.org/" arch="all" @@ -15,6 +15,7 @@ install="$pkgname.post-upgrade" subpackages="$pkgname-doc $pkgname-sample-config:samples:noarch $pkgname-common $pkgname-snmp" source="http://www.keepalived.org/software/$pkgname-$pkgver.tar.gz + always-use-pid-dir.patch $pkgname.initd $pkgname.confd " @@ -103,5 +104,6 @@ samples() { } sha512sums="283bfb35052c8f742050c03ce1b24c3db19fb43fbee9307b50ae719b5d06e461dfa4fda3a167afddd2aae216a97f6e84f79c5f0bdbe5c439f339b0f41fa83cd7 keepalived-1.3.9.tar.gz -12361313dd044269150c9ea1a4ffc6987075b0106dfdd4b3804b1852d2a47f608d954ab473419474747b475c98fade3779800be8147134969016817cfa050ee4 keepalived.initd -413cb05aa2d1d8c0f552398bb5d511ee022b4d07f5b18217350c1159d013f2d26d87ae63d2977329ec78d7416760e84c4048a5ad20a1f63ef2bc3a1a84c3a41a keepalived.confd" +469458b60c90948dff39fc587dbe076bece3ee5f834461110996c27802bd3690008e0034a9566648816f43cf8cc058cb7d1760358b81bbd070544e77f14391fa always-use-pid-dir.patch +4f1a3fdb0a936707a234efa063296f575fa8168551c87d2f9d43b7681d24605f852b4ddb2c674d1e311111f85232a708939a71cf128eb57c940ccb6927518dd4 keepalived.initd +2e6a9411d78fb954b5ede75d04225bf3f37d9ef4773c2b3587e1de1a0795f61a1ed784fa229854c2ee97f153205c3f76b3ff79cd55ede07f211731f0d17569cb keepalived.confd" diff --git a/community/keepalived/always-use-pid-dir.patch b/community/keepalived/always-use-pid-dir.patch new file mode 100644 index 0000000000..fe9a081335 --- /dev/null +++ b/community/keepalived/always-use-pid-dir.patch @@ -0,0 +1,17 @@ +keepalived insists on creating PID files, so at least don't let it create in +/run (to avoid clash with OpenRC), but /run/keepalived. keepalived will +automatically create and delete this directory. + +This is a downstream patch. + +--- a/keepalived/core/main.c ++++ b/keepalived/core/main.c +@@ -87,7 +87,7 @@ + #endif + static char *syslog_ident; /* syslog ident if not default */ + char *instance_name; /* keepalived instance name */ +-bool use_pid_dir; /* Put pid files in /var/run/keepalived or @localstatedir@/run/keepalived */ ++bool use_pid_dir = true; /* Put pid files in /var/run/keepalived or @localstatedir@/run/keepalived */ + + unsigned os_major; /* Kernel version */ + unsigned os_minor; diff --git a/community/keepalived/keepalived.confd b/community/keepalived/keepalived.confd index 7979109c0f..928699ca7d 100644 --- a/community/keepalived/keepalived.confd +++ b/community/keepalived/keepalived.confd @@ -1,2 +1,13 @@ -# Keepalived options, see keepalived(8) man page. -#KEEPALIVED_OPTS="-D" +# Configuration for /etc/init.d/keepalived + +# Path of the configuration file. +#cfgfile="/etc/keepalived/keepalived.conf" + +# Skip any configuration lines beginning '@' that don't match this id +# or any lines beginning @^ that do match. +# The config-id defaults to the node name if option not used. +#config_id= + +# Additional options to pass to the keepalived command. +# See keepalived(8) man page. +#command_args="" diff --git a/community/keepalived/keepalived.initd b/community/keepalived/keepalived.initd index 760c360c89..ce3d1a3b79 100644 --- a/community/keepalived/keepalived.initd +++ b/community/keepalived/keepalived.initd @@ -1,13 +1,23 @@ #!/sbin/openrc-run -# Copyright 1999-2013 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -extra_commands="reload" +extra_started_commands="data reload stats" +description_data="Write configuration data to /tmp/keepalived.data" +description_reload="Close down all interfaces, reload its configuration, and start up with new configuration" +description_stats="Print statistics info" + +: ${cfgfile:="/etc/keepalived/keepalived.conf"} command="/usr/sbin/keepalived" -command_args="${KEEPALIVED_OPTS}" -pidfile="/run/keepalived.pid" -required_files="/etc/keepalived/keepalived.conf" +# Note: KEEPALIVED_OPTS is for backward compatibility. +command_args=" + --dont-fork + --use-file=$cfgfile + ${config_id:+"--config-id=$config_id"} + ${command_args:-${KEEPALIVED_OPTS:-}}" +command_background="yes" +pidfile="/run/$RC_SVCNAME.pid" + +required_files="$cfgfile" depend() { use logger @@ -16,8 +26,22 @@ depend() { use net } +data() { + ebegin "Writing configuration data to /tmp/keepalived.data" + start-stop-daemon --pidfile $pidfile --signal USR1 + eend $? +} + reload() { ebegin "Reloading keepalived.conf" start-stop-daemon --pidfile $pidfile --signal HUP eend $? } + +stats() { + ebegin "Dumping stats" + start-stop-daemon --pidfile $pidfile --signal USR2 + eend $? + + cat /tmp/keepalived.stats +} -- cgit v1.2.3