improve pveupdate with random start time

this is important to avoid that all PVE nodes start the update procedure at the same time
This commit is contained in:
Wolfgang Link 2015-09-01 12:47:34 +02:00 committed by Dietmar Maurer
parent 8002175e60
commit c93559150b
6 changed files with 17 additions and 23 deletions

View File

@ -17,6 +17,7 @@ SCRIPTS = \
pveversion \
pvemailforward.pl \
pveupgrade \
pveupdate \
pveperf
SERVICE_MANS = $(addsuffix .8, ${SERVICES})

View File

@ -1,6 +0,0 @@
SUBDIRS = daily
all: ${SUBDIRS}
%:
set -e && for i in ${SUBDIRS}; do ${MAKE} -C $$i $@; done

View File

@ -1,15 +0,0 @@
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 *~

View File

@ -25,7 +25,7 @@ my $rpcenv = PVE::RPCEnvironment->init('cli');
$rpcenv->init_request();
$rpcenv->set_language($ENV{LANG});
$rpcenv->set_user('root@pam');
$rpcenv->set_user('root@pam');
my $nodename = PVE::INotify::nodename();

1
debian/conffiles vendored
View File

@ -3,7 +3,6 @@
/etc/init.d/pveproxy
/etc/init.d/spiceproxy
/etc/init.d/pvestatd
/etc/cron.daily/pve
/etc/vz/vznet.conf
/etc/vzdump.conf
/etc/logrotate.d/pve

15
debian/postinst vendored
View File

@ -43,6 +43,21 @@ case "$1" in
# remove old APL dir
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
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