Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Add a random delay to pkg-audit when invoked without a TTY
Brad Davis committed 10 years ago
commit e89147c93bf443877073a95f8d80018279b7da9e
parent bccb702
1 file changed +4 -0
modified scripts/periodic/410.pkg-audit.in
@@ -55,6 +55,10 @@ audit_pkgs() {
    if [ $rc -ne 0 -o \
	$(( 86400 \* "${daily_status_security_pkgaudit_expiry:-2}" )) \
	-le $(( ${now} - ${then} + 600 )) ]; then
+
	# Random delay so the mirrors do not get slammed when run by periodic(8)
+
	if [ ! -t 0 ]; then
+
	    sleep `jot -r 1 0 3600`
+
	fi
	${pkgcmd} ${pkgargs} audit -F $q || { rc=$?; [ $rc -lt 3 ] && rc=3; }
    else
	echo -n 'Database fetched: '