Scheduler tasks are only valid for backend context. So register them for backend in ext_localconf.php.