Update wait_for_sshd to try to avoid an infinite loop