Fix watchdog_run to use base 16 arithmetic for host hash calculation

develop
Dominik Dzienia 5 days ago
parent 53e19d515a
commit a623819939

@ -162,7 +162,7 @@ get_watchdog_status() {
watchdog_run() { watchdog_run() {
local host_hash local host_hash
host_hash=$(printf '%s' "$(hostname)" | md5sum | awk '{print $1}' | cut -c1-8 | xargs printf '%d' 16 16) host_hash=$(( 16#$(printf '%s' "$(hostname)" | md5sum | awk '{print $1}' | cut -c1-8) ))
local offset=$(( host_hash % 300 )) local offset=$(( host_hash % 300 ))
echo "Watchdog delay: sleeping ${offset}s (host-based offset)" echo "Watchdog delay: sleeping ${offset}s (host-based offset)"
sleep "$offset" sleep "$offset"

Loading…
Cancel
Save