[X2Go-Commits] [live-build-x2go] 37/58: added support for updatesleep parameter
git-admin at x2go.org
git-admin at x2go.org
Tue Feb 14 09:34:11 CET 2017
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch feature/openbox
in repository live-build-x2go.
commit 3ec1530dc2b4c0cc4271184c3d7db3fcec830004
Author: Stefan Baur (BAUR-ITCS) <kontakt at baur-itcs.de>
Date: Mon Jan 2 10:41:59 2017 +0100
added support for updatesleep parameter
---
.../lib/live/config/2300-live-autoupdate | 25 ++++++++++++--------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/config/includes.chroot/lib/live/config/2300-live-autoupdate b/config/includes.chroot/lib/live/config/2300-live-autoupdate
index 62afd3c..ee24683 100755
--- a/config/includes.chroot/lib/live/config/2300-live-autoupdate
+++ b/config/includes.chroot/lib/live/config/2300-live-autoupdate
@@ -81,17 +81,22 @@ fi
# sleeping a random amount of time to ease load on the update server
#
+MAXSLEEPTIME=$(cat /proc/cmdline | \
+ tr ' ' '\n' | \
+ awk -F'=' ' /^updatesleep=/ && $2 ~ /^[0-9]*$/ { print $2 }')
+if [ -z "$MAXSLEEPTIME" ] || [ $MAXSLEEPTIME -lt 120 ] ; then
+ MAXSLEEPTIME=900
+fi
SLEEPTIME=0
-echo -n "Calculating random update delay (120-900 seconds)..."
-while [ $SLEEPTIME -lt 120 ]; do
- echo -n "."
- # During startup, script is run with /bin/sh,
- # even when #!/bin/bash is set,
- # so we need to improvise.
- RND=$(/bin/bash -c 'echo $RANDOM')
- SLEEPTIME=$((RND%900))
-done
-echo " "
+echo "Calculating random update delay (120-$MAXSLEEPTIME seconds)..."
+# During startup, script is run with /bin/sh,
+# even when #!/bin/bash is set,
+# so we need to improvise.
+RND=$(/bin/bash -c 'echo $RANDOM')
+SLEEPTIME=$((RND%MAXSLEEPTIME))
+if [ $SLEEPTIME -lt 120 ]; then
+ SLEEPTIME=$((SLEEPTIME+120))
+fi
echo "Sleeping for $SLEEPTIME seconds ..."
sleep $SLEEPTIME
--
Alioth's /srv/git/code.x2go.org/live-build-x2go.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/live-build-x2go.git
More information about the x2go-commits
mailing list