From ae57ba9a5c426e747ae87e08507afc62efbc7beb Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sat, 6 Jan 2024 01:22:14 +0100 Subject: [PATCH] systemd service [release 1.2.20-2mamba;Mon Apr 18 2016] --- README.md | 9 +++------ keepalived.service | 17 ++++++++++++++++ keepalived.spec | 49 ++++++++++++++++++++++++---------------------- 3 files changed, 46 insertions(+), 29 deletions(-) create mode 100644 keepalived.service diff --git a/README.md b/README.md index ec51b5c..37f7b8a 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,12 @@ # keepalived -The main goal of the keepalived project is to add a strong end robust keepalive -facility to the Linux Virtual Server project. +The main goal of the keepalived project is to add a strong end robust keepalive facility to the Linux Virtual Server project. This project is written in C with multilayer TCP/IP stack checks. Keepalived implements a framework based on three family checks: Layer3, Layer4 & Layer5. This framework gives the daemon the ability of checking a LVS server pool states. -When one of the server of the LVS server pool is down, keepalived informs the linux -kernel via a setsockopt call to remove this server entrie from the LVS topology. +When one of the server of the LVS server pool is down, keepalived informs the linux kernel via a setsockopt call to remove this server entrie from the LVS topology. In addition keepalived implements a VRRPv2 stack to handle director failover. -So in short keepalived is a userspace daemon for LVS cluster nodes healthchecks -and LVS directors failover. +So in short keepalived is a userspace daemon for LVS cluster nodes healthchecks and LVS directors failover. diff --git a/keepalived.service b/keepalived.service new file mode 100644 index 0000000..b768ca6 --- /dev/null +++ b/keepalived.service @@ -0,0 +1,17 @@ +[Unit] +Description=Keepalive Daemon (LVS and VRRP) +After=syslog.target network-online.target +Wants=network-online.target +# Only start if there is a configuration file +ConditionFileNotEmpty=/etc/keepalived/keepalived.conf + +[Service] +Type=forking +KillMode=process +# Read configuration variable file if it is present +EnvironmentFile=-/etc/sysconfig/keepalived +ExecStart=/usr/sbin/keepalived $KEEPALIVED_OPTIONS +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/keepalived.spec b/keepalived.spec index 7b8369e..d67c17e 100644 --- a/keepalived.spec +++ b/keepalived.spec @@ -1,6 +1,6 @@ Name: keepalived Version: 1.2.20 -Release: 1mamba +Release: 2mamba Summary: HA monitor built upon LVS, VRRP and services poller Group: Applications/Networking Vendor: openmamba @@ -8,28 +8,27 @@ Distribution: openmamba Packager: Silvan Calarco URL: http://www.keepalived.org/ Source: http://www.keepalived.org/software/%{name}-%{version}.tar.gz +Source1: keepalived.service Patch: %{name}-1.1.10-manpath.patch License: GPL ## AUTOBUILDREQ-BEGIN BuildRequires: glibc-devel -BuildRequires: libopenssl-devel >= 0.9.8h -BuildRequires: libpopt-devel +BuildRequires: iptables-devel +BuildRequires: libnl-devel +BuildRequires: libopenssl-devel ## AUTOBUILDREQ-END BuildRoot: %{_tmppath}/%{name}-%{version}-root %description -The main goal of the keepalived project is to add a strong end robust keepalive -facility to the Linux Virtual Server project. +The main goal of the keepalived project is to add a strong end robust keepalive facility to the Linux Virtual Server project. This project is written in C with multilayer TCP/IP stack checks. Keepalived implements a framework based on three family checks: Layer3, Layer4 & Layer5. This framework gives the daemon the ability of checking a LVS server pool states. -When one of the server of the LVS server pool is down, keepalived informs the linux -kernel via a setsockopt call to remove this server entrie from the LVS topology. +When one of the server of the LVS server pool is down, keepalived informs the linux kernel via a setsockopt call to remove this server entrie from the LVS topology. In addition keepalived implements a VRRPv2 stack to handle director failover. -So in short keepalived is a userspace daemon for LVS cluster nodes healthchecks -and LVS directors failover. +So in short keepalived is a userspace daemon for LVS cluster nodes healthchecks and LVS directors failover. %prep %setup -q @@ -45,24 +44,25 @@ and LVS directors failover. [ "%{buildroot}" != / ] && rm -rf %{buildroot} %makeinstall +install -D -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/keepalived.service + +rm -rf %{buildroot}%{_initrddir} + %post -/sbin/chkconfig --add keepalived -%{_initrddir}/keepalived start -exit 0 +%systemd_post keepalived +: %preun -if [ $1 -eq 0 ]; then - [ -e /var/lock/subsys/keepalived ] && %{_initrddir}/keepalived stop - /sbin/chkconfig --del keepalived -fi -exit 0 +%systemd_preun keepalived +: %postun -if [ $1 -eq 1 ]; then - [ -e /var/lock/subsys/keepalived ] && - %{_initrddir}/keepalived restart -fi -exit 0 +%systemd_postun_with_restart keepalived +: + +%posttrans +find /etc/rc[0-6].d/ -type l -xtype l -exec rm -f {} \; +: %clean [ "%{buildroot}" != / ] && rm -rf %{buildroot} @@ -72,7 +72,7 @@ exit 0 %dir %{_sysconfdir}/keepalived/ %config(noreplace) %{_sysconfdir}/keepalived/* %config(noreplace) %{_sysconfdir}/sysconfig/keepalived -%{_initrddir}/keepalived +%{_unitdir}/keepalived.service %{_bindir}/genhash %{_sbindir}/keepalived #%{_datadir}/snmp/mibs/*-MIB @@ -82,6 +82,9 @@ exit 0 #% doc doc/keepalived.conf.SYNOPSIS doc/samples/ %changelog +* Mon Apr 18 2016 Silvan Calarco 1.2.20-2mamba +- systemd service + * Sun Apr 17 2016 Automatic Build System 1.2.20-1mamba - automatic version update by autodist