mirror-update: make jobs interactive by default

If you are running these jobs by hand you are doing something that
will be expected to take a long time (initial sync, recovery, etc.).
Make these scripts assume interactivity and default to *not* running
under timeout -- it's too easy to forget NO_TIMEOUT when running
manually and having the job killed.

We already have an UNDER_CRON variable set so that we only send stats
when running ... under cron.  Reuse this here for the timeout flag.

Change-Id: Ic2d2f39bb18d247c853284512fe0dc37485c00a4
This commit is contained in:
Ian Wienand 2022-09-14 08:22:14 +10:00
parent 741f5b333d
commit a6ece2cacc
No known key found for this signature in database
9 changed files with 36 additions and 24 deletions

View File

@ -528,7 +528,7 @@ our mirror update cron jobs, manually perform the first mirror update:
``timeout`` with shorter periods than may be required for the
initial full sync. e.g. for ``reprepro`` mirrors
NO_TIMEOUT=1 /usr/local/bin/reprepro-mirror-update /etc/reprepro/ubuntu mirror.ubuntu
/usr/local/bin/reprepro-mirror-update /etc/reprepro/ubuntu mirror.ubuntu
* Log into ``afs01.dfw.openstack.org`` and run ``screen``. Within
that session, periodically during the sync, and once again after it

View File

@ -17,11 +17,13 @@ source /usr/share/mirror-update/functions.sh
MIRROR_VOLUME=$1
if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then
echo "Running interactively"
# Runs with timeout under cron
if [[ ${UNDER_CRON:-0} -eq 0 ]]; then
echo_ts "Running interactively"
TIMEOUT=""
set -x
else
TIMEOUT="timeout -k 2m 30m"
TIMEOUT="timeout -k 2m 90m"
fi
_DRY_RUN=''

View File

@ -17,11 +17,13 @@ source /usr/share/mirror-update/functions.sh
MIRROR_VOLUME=$1
if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then
echo "Running interactively"
# Runs with timeout under cron
if [[ ${UNDER_CRON:-0} -eq 0 ]]; then
echo_ts "Running interactively"
TIMEOUT=""
set -x
else
TIMEOUT="timeout -k 2m 30m"
TIMEOUT="timeout -k 2m 90m"
fi
_DRY_RUN=''

View File

@ -17,11 +17,13 @@ source /usr/share/mirror-update/functions.sh
MIRROR_VOLUME=$1
if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then
echo "Running interactively"
# Runs with timeout under cron
if [[ ${UNDER_CRON:-0} -eq 0 ]]; then
echo_ts "Running interactively"
TIMEOUT=""
set -x
else
TIMEOUT="timeout -k 2m 30m"
TIMEOUT="timeout -k 2m 90m"
fi
BASE="/afs/.openstack.org/mirror/epel"

View File

@ -17,12 +17,13 @@ source /usr/share/mirror-update/functions.sh
MIRROR_VOLUME=$1
if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then
# Runs with timeout under cron
if [[ ${UNDER_CRON:-0} -eq 0 ]]; then
echo_ts "Running interactively"
set -x
TIMEOUT=""
set -x
else
TIMEOUT="timeout -k 2m 30m"
TIMEOUT="timeout -k 2m 90m"
fi
BASE="/afs/.openstack.org/mirror/fedora"

View File

@ -20,11 +20,13 @@ source /usr/share/mirror-update/functions.sh
MIRROR_VOLUME=$1
if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then
# Runs with timeout under cron
if [[ ${UNDER_CRON:-0} -eq 0 ]]; then
echo_ts "Running interactively"
TIMEOUT=""
set -x
else
TIMEOUT="timeout -k 2m 30m"
TIMEOUT="timeout -k 2m 90m"
fi
BASE="/afs/.openstack.org/mirror/openeuler"

View File

@ -17,11 +17,13 @@ source /usr/share/mirror-update/functions.sh
MIRROR_VOLUME=$1
if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then
echo "Running interactively"
# Runs with timeout under cron
if [[ ${UNDER_CRON:-0} -eq 0 ]]; then
echo_ts "Running interactively"
TIMEOUT=""
set -x
else
TIMEOUT="timeout -k 2m 30m"
TIMEOUT="timeout -k 2m 90m"
fi
BASE="/afs/.openstack.org/mirror/opensuse"

View File

@ -17,11 +17,13 @@ source /usr/share/mirror-update/functions.sh
MIRROR_VOLUME=$1
if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then
echo "Running interactively"
# Runs with timeout under cron
if [[ ${UNDER_CRON:-0} -eq 0 ]]; then
echo_ts "Running interactively"
TIMEOUT=""
set -x
else
TIMEOUT="timeout -k 2m 30m"
TIMEOUT="timeout -k 2m 90m"
fi
BASE="/afs/.openstack.org/mirror/yum-puppetlabs"

View File

@ -16,9 +16,8 @@
source /usr/share/mirror-update/functions.sh
# For initial clones, and debugging, set this for more verbose output
# that doesn't time out.
if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then
# Runs with timeout under cron
if [[ ${UNDER_CRON:-0} -eq 0 ]]; then
echo_ts "Running interactively"
TIMEOUT=""
set -x