Commit d6b52850 authored by Wolfgang Link's avatar Wolfgang Link Committed by Dietmar Maurer

improve pveupdate with random start time

this is important to avoid that all PVE nodes start the update procedure at the same time
parent b3874f00
...@@ -17,6 +17,7 @@ SCRIPTS = \ ...@@ -17,6 +17,7 @@ SCRIPTS = \
pveversion \ pveversion \
pvemailforward.pl \ pvemailforward.pl \
pveupgrade \ pveupgrade \
pveupdate \
pveperf pveperf
SERVICE_MANS = $(addsuffix .8, ${SERVICES}) SERVICE_MANS = $(addsuffix .8, ${SERVICES})
......
SUBDIRS = daily
all: ${SUBDIRS}
%:
set -e && for i in ${SUBDIRS}; do ${MAKE} -C $$i $@; done
include ../../../defines.mk
all:
.PHONY: install
install: pve
install -d ${CRONDAILYDIR}
install -m 0755 pve ${CRONDAILYDIR}
.PHONY: distclean
distclean: clean
.PHONY: clean
clean:
rm -rf *~
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
/etc/init.d/pveproxy /etc/init.d/pveproxy
/etc/init.d/spiceproxy /etc/init.d/spiceproxy
/etc/init.d/pvestatd /etc/init.d/pvestatd
/etc/cron.daily/pve
/etc/vz/vznet.conf /etc/vz/vznet.conf
/etc/vzdump.conf /etc/vzdump.conf
/etc/logrotate.d/pve /etc/logrotate.d/pve
......
...@@ -43,6 +43,21 @@ case "$1" in ...@@ -43,6 +43,21 @@ case "$1" in
# remove old APL dir # remove old APL dir
rm -rf /var/lib/pve-manager/apl-available rm -rf /var/lib/pve-manager/apl-available
# 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
# create new daily randomize update cronjob if not exist
if !(test -e /etc/cron.d/pveupdate); then
MIN="$(shuf -i 0-59 -n 1)"
HOUR="$(shuf -i 6-10 -n 1)"
echo "Create cron job for daily update"
printf " ${MIN} ${HOUR} * * * root /usr/bin/pveupdate\n\n" > /etc/cron.d/pveupdate
fi
if test ! -e /var/lib/pve-manager/apl-info/download.proxmox.com; then if test ! -e /var/lib/pve-manager/apl-info/download.proxmox.com; then
mkdir -p /var/lib/pve-manager/apl-info 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 cp /usr/share/doc/pve-manager/aplinfo.dat /var/lib/pve-manager/apl-info/download.proxmox.com
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment