add systemd timer unit to trigger pvesr run

This commit is contained in:
Wolfgang Link 2017-06-02 11:21:46 +02:00 committed by Dietmar Maurer
parent efa075d9be
commit c74a828da0
5 changed files with 49 additions and 1 deletions

View File

@ -18,7 +18,9 @@ SERVICES= \
pvedaemon.service \
pveproxy.service \
spiceproxy.service \
pve-storage.target
pve-storage.target \
pvesr.service \
pvesr.timer
.PHONY: install
install: ${SCRIPTS}

5
bin/init.d/pvesr.service Normal file
View File

@ -0,0 +1,5 @@
[Unit]
Description=Proxmox VE replication runner
[Service]
ExecStart=@/usr/bin/pvesr "/usr/bin/pvesr" "run"

11
bin/init.d/pvesr.timer Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=Proxmox VE replication runner
[Timer]
RemainAfterElapse=no
[Timer]
OnCalendar=minutely
[Install]
WantedBy=timers.target

17
debian/postinst vendored
View File

@ -95,6 +95,21 @@ EOF
# same as dh_systemd_enable (code copied)
for timer in pvesr; do
deb-systemd-helper unmask $timer.timer >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled $timer.timer; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable $timer.timer >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state $timer.timer >/dev/null || true
fi
done
for service in pvedaemon pveproxy spiceproxy pvestatd pvebanner pvenetcommit pve-manager; do
deb-systemd-helper unmask $service.service >/dev/null || true
@ -115,6 +130,8 @@ EOF
for service in pvedaemon pveproxy spiceproxy pvestatd; do
deb-systemd-invoke reload-or-restart $service
done
deb-systemd-invoke start pvesr.timer >/dev/null || true
fi
# rewrite banner

13
debian/postrm vendored
View File

@ -23,7 +23,14 @@ esac
systemctl --system daemon-reload >/dev/null || true
PVESERVICES="pvedaemon pveproxy spiceproxy pvestatd pvebanner pvenetcommit pve-manager"
PVETIMERS="pvesr"
if [ "$1" = "remove" ]; then
for timer in ${PVETIMERS}; do
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper mask $timer.timer >/dev/null
fi
done
for service in ${PVESERVICES}; do
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper mask $service.service >/dev/null
@ -32,6 +39,12 @@ if [ "$1" = "remove" ]; then
fi
if [ "$1" = purge ]; then
for timer in ${PVETIMERS}; do
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper purge $timer.timer >/dev/null
deb-systemd-helper unmask $timer.timer >/dev/null
fi
done
for service in ${PVESERVICES}; do
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper purge $service.service >/dev/null