systemd: add kdnotify.service, kdnotify.socket
As we expect this project to be mostly run as a system service, provide out of the box configuration files for systemd. Notably, we add a .socket file allowing systemd to lazily start kdnotify when a notify event is received on its socket. We also hardlink the socket out into the /run/ directory, such that keepalived does not need to peak inside kdnotify runtime dir. We also link the lifecycle of kdnotify to keepalived, as once it has been stopped it is unlikely we'll receive new messages.
This commit is contained in:
parent
d9ff2c6477
commit
dc343acf44
|
@ -15,7 +15,5 @@
|
|||
!*.sh
|
||||
!*.yaml
|
||||
|
||||
!systemd/*
|
||||
!*/
|
||||
|
||||
src/
|
||||
pkg/
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
[Unit]
|
||||
Description=Keepalived notify handler
|
||||
Documentation=https://git.st8l.com/luxolus/kdnotify
|
||||
Before=keepalived.service
|
||||
StopPropagatedFrom=keepalived.service
|
||||
JoinsNamespaceOf=keepalived.service
|
||||
|
||||
[Service]
|
||||
RuntimeDirectory=kdnotify
|
||||
ConfigurationDirectory=kdnotify
|
||||
EnvironmentFile=-/etc/default/kdnotify
|
||||
ExecStart=/bin/kdnotify watch $EXTRAOPTS ${RUNTIME_DIRECTORY}/notify.fifo
|
||||
KillSignal=SIGINT
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=kdnotify FIFO socket
|
||||
Documentation=https://git.st8l.com/luxolus/kdnotify
|
||||
|
||||
[Socket]
|
||||
ListenFIFO=/run/kdnotify/notify.fifo
|
||||
ExecStartPost=/bin/ln -f /run/kdnotify/notify.fifo /run/kdnotify.fifo
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
Loading…
Reference in New Issue