# how many times to fail in attempting to contact primary server
# before falling back to original. if the backup fails this many times
# too, then the process is repeated started with the primary server
-ATTEMPTS_BEFORE_BACKUP=2
+ATTEMPTS_BEFORE_BACKUP=3
# where all the configuration files for contacting
# the boot server are stored
echo "pl_boot: got request to cancel boot, exiting"
exit 0
fi
-
- if [[ $contact_count -ne 0 ]]; then
- echo "pl_boot: fetching new script in 30 seconds"
- /bin/sleep 30
- fi
- ((contact_count++))
- if [[ $contact_count > $ATTEMPTS_BEFORE_BACKUP ]]; then
+ if [[ $contact_count -ge $ATTEMPTS_BEFORE_BACKUP ]]; then
contact_count=0
fi
fi
+ if [[ $contact_count != 0 ]]; then
+
+ if [[ $on_backup_server == 1 ]]; then
+ echo "pl_boot: attempting to fetch script from backup server in 30s"
+ else
+ echo "pl_boot: attempting to fetch script from primary server in 30s"
+ fi
+ /bin/sleep 30
+ fi
+
# assemble the curl transaction
CURL_CMD="/usr/bin/curl \
--connect-timeout 60 \
/bin/sed 's/ //g' > /tmp/nonce
echo "pl_boot: fetching script from boot server $CONNECT_BOOT_SERVER"
+ ((contact_count++))
rm -f $UNVERIFIED_SCRIPT
$CURL_CMD
curl_err=$?