mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-05 09:07:19 +00:00
pveupdate: replace cron job with systemd timer
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
07bbb52f76
commit
3877d4bff5
@ -11,6 +11,8 @@ SERVICES= \
|
||||
pveproxy.service \
|
||||
spiceproxy.service \
|
||||
pve-storage.target \
|
||||
pve-daily-update.service\
|
||||
pve-daily-update.timer \
|
||||
pvesr.service \
|
||||
pvesr.timer
|
||||
|
||||
|
9
bin/init.d/pve-daily-update.service
Normal file
9
bin/init.d/pve-daily-update.service
Normal file
@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Daily PVE download activities
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/pveupdate
|
||||
|
10
bin/init.d/pve-daily-update.timer
Normal file
10
bin/init.d/pve-daily-update.timer
Normal file
@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Daily PVE download activities
|
||||
|
||||
[Timer]
|
||||
OnCalendar=*-*-* 2:00
|
||||
RandomizedDelaySec=4h
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
17
debian/postinst
vendored
17
debian/postinst
vendored
@ -32,26 +32,15 @@ case "$1" in
|
||||
|
||||
mkdir /etc/pve 2>/dev/null || true
|
||||
|
||||
# remove old cron.daily update job to randomize it
|
||||
if test -e /etc/cron.daily/pve; then
|
||||
echo "Remove old update script from cron.daily"
|
||||
rm /etc/cron.daily/pve
|
||||
fi
|
||||
|
||||
if dpkg --compare-versions "$2" '<=' '5.1-47'; then
|
||||
# remove cron update job, superseded by systemd timer
|
||||
rm -f /etc/cron.d/pveupdate
|
||||
|
||||
# remove old/unused init.d files
|
||||
OLD_INITD_FILES="pvebanner pvenetcommit pve-manager pvedaemon pveproxy pvestatd spiceproxy"
|
||||
for f in ${OLD_INITD_FILES}; do rm -f "/etc/init.d/$f"; done
|
||||
fi
|
||||
|
||||
# create new daily randomize update cronjob if not exist
|
||||
MIN="$(shuf -i 0-59 -n 1)"
|
||||
HOUR="$(shuf -i 2-5 -n 1)"
|
||||
cat <<EOF >/etc/cron.d/pveupdate
|
||||
# automatically generated - do not edit
|
||||
${MIN} ${HOUR} * * * root /usr/bin/pveupdate
|
||||
EOF
|
||||
|
||||
if test ! -e /var/lib/pve-manager/apl-info/download.proxmox.com; then
|
||||
mkdir -p /var/lib/pve-manager/apl-info
|
||||
cp /usr/share/doc/pve-manager/aplinfo.dat /var/lib/pve-manager/apl-info/download.proxmox.com
|
||||
|
Loading…
Reference in New Issue
Block a user