pick_server: Cast date to decimal

Otherwise, days <10 will be octal, because starting with a 0.
This commit is contained in:
Benoît.S 2019-04-08 10:38:24 +02:00
parent 933b0c6842
commit 3150123671
1 changed files with 2 additions and 1 deletions

View File

@ -80,7 +80,8 @@ pick_server() {
salt=$(hostname | cksum | cut -d' ' -f1) salt=$(hostname | cksum | cut -d' ' -f1)
# Pick an integer between 0 and the length of the SERVERS list # Pick an integer between 0 and the length of the SERVERS list
# It changes each day # It changes each day
item=$(( ($(date +%d) + salt + increment) % list_length )) today=10#$(date +%d)
item=$(( ($today + salt + increment) % list_length ))
# cut starts counting fields at 1, not 0. # cut starts counting fields at 1, not 0.
field=$(( item + 1 )) field=$(( item + 1 ))