On Magnolia, I've created a Groovy script to delete unused users. When I run the Groovy script directly from the "DEV > Groovy scripts" interface (on the admin central), it works fine.
Now, I'm trying to schedule the execution of that script. So I've configured a Command and a Scheduler.
The command : scheduler > config > commands > default > groovyDeleteUsers with attributes: - class = my.commandes.GroovyDeleteAllPublicUsersCommand
The Scheduler : scheduler > config > jobs > deleteUsersJob with attributes:
- active=true
- catalog=default
- command=groovyDeleteUsers
- cron=0 0 8 * * * *
Here is how my Groovy script is structured :
package my.commands;
import info.magnolia.commands.*;
import info.magnolia.context.MgnlContext;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
public class GroovyDeleteAllPublicUsersCommand extends MgnlCommand {
public boolean execute(Context ctx) {
....
}
}
The problem is that the scheduler job is not able to see my command.
Magnolia Can't find command [groovyDeleteUsers] for job in catalog [{default}]
I've try the JCR query : "select * from nt:base where jcr:path like '%/commands/%'" as specified in the documentation, and my newly created command is in the result.
[EDIT] It seems the problem come from the command.
When I try defining a command with an existing class like info.magnolia.commands.impl.ImportCommand
the command is well registred by the applicaation.
But when I try with my my.commandes.GroovyDeleteAllPublicUsersCommand
the application doesn't registrer my newly created command.
So do you have any idea?
Thanks for helping, Regards, Jimmy