I have a plugin with a cli cron endpoint that does some backup and restore operations. It's failing on a call to require_login that is getting executed in validate_context(), which gets called from course/externallib.php's duplicate_course (and elsewhere).
I notice that if I call this entry point in the plugin from moodlecron there is not problem. it's just when I schedule it independently as its own cron script that we see this problem.
Any suggestion how to get around this? how do you get a cli cron script to be logged in?
Thanks!
Alan