POSIX shell script and function to schedule commands