Run a function on a schedule