On Tue, 18 Apr 2017 13:55:34 +0500 arista...@aristarkh.net wrote:
> Package: keepalived
> Version: 1:1.3.2-1
>
> When restart the keepalived systemd loses the MainPID of process.
>
> root@testmaw0:/itmh/scripts# systemctl status keepalived
> ● keepalived.service - Keepalive Daemon (LVS and VRRP)
> Loaded: loaded (/lib/systemd/system/keepalived.service; enabled; vendor 
> preset: enabled)
> Active: active (running) since Tue 2017-04-18 12:33:29 +05; 26s ago
> Process: 24042 ExecStart=/usr/sbin/keepalived $DAEMON_ARGS (code=exited, 
> status=0/SUCCESS)
> Main PID: 24043 (keepalived)
> Tasks: 2 (limit: 4915)
> CGroup: /system.slice/keepalived.service
> ├─24043 /usr/sbin/keepalived -P -D
> └─24044 /usr/sbin/keepalived -P -D
>
> root@testmaw0:/itmh/scripts# systemctl restart keepalived
> root@testmaw0:/itmh/scripts# systemctl status keepalived
> ● keepalived.service - Keepalive Daemon (LVS and VRRP)
> Loaded: loaded (/lib/systemd/system/keepalived.service; enabled; vendor 
> preset: enabled)
> Active: active (running) since Tue 2017-04-18 12:34:03 +05; 1s ago
> Process: 24124 ExecStart=/usr/sbin/keepalived $DAEMON_ARGS (code=exited, 
> status=0/SUCCESS)
> Main PID: 24043 (code=exited, status=0/SUCCESS)
> Tasks: 2 (limit: 4915)
> CGroup: /system.slice/keepalived.service
> ├─24127 /usr/sbin/keepalived -P -D
> └─24128 /usr/sbin/keepalived -P -D
>
> After restart keepalived Main PID still 24043, whereas the new pid is 24127. 
> After that commands like systemctl restart keepalived, systemctl reload 
> keepalived and systemctl stop keepalived not working.
>
> Solution:
> Add to the Systemd Unit keepalived.service option PIDFile= with keepalived 
> pidfile, like this:
> [Unit]
> Description=Keepalive Daemon (LVS and VRRP)
> After=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
> PIDFile=/var/run/keepalived.pid
> # Read configuration variable file if it is present
> EnvironmentFile=-/etc/default/keepalived
> ExecStart=/usr/sbin/keepalived $DAEMON_ARGS
> ExecReload=/bin/kill -HUP $MAINPID
>
> [Install]
> WantedBy=multi-user.target
>
> After adding this option the keepalived is correctly restarting and systemctl 
> shows the correct Main PID.
>
> I am using Debian GNU/Linux 9.0, kernel 4.9.0-1-amd64.
>
>

This behavior occurs when I use the notify_stop option in keepalived.conf. 

Reply via email to