Update functions.sh

Added exec_with_retry function