From 7fdd0300b294588dac2f46b5ccdfce90a36caac7 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Thu, 16 Jan 2014 23:46:54 +0100 Subject: [PATCH] alfred: Add --no-sleep option to send immediately --- package/gluon-alfred/files/lib/gluon/alfred/announce.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh index c24c1b23..de0c9181 100755 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh @@ -23,8 +23,10 @@ set -e # simultaneously, wait for a random time between 0 and 300 seconds, but fixed # for each device to maintain 5 minutes between updates. # Calculated using first 3 hex digits of the primary MAC address' MD5 hash -DELAY=$((0x$(sysconfig primary_mac | md5sum | head -c3) * $MAX_WAIT / (16**3))) -sleep $DELAY +if [ "$1" != "--no-sleep" ]; then + DELAY=$((0x$(sysconfig primary_mac | md5sum | head -c3) * $MAX_WAIT / (16**3))) + sleep $DELAY +fi json_init json_add_string "hostname" "$(uci get 'system.@system[0].hostname')"