Hello everyone,
i tried to add a script into the crontab and make it run every week,
but i got AccessDeniedException : Sorry, only for admin user. Here is my script:
i can run it normally when i click the Execute button ( flash icon ), but it cannot run automatically, i will get a message : nullPointerException,
So, how can i get the admin right to run those script ?
ps. I am using openkm 6.2.5
i tried to add a script into the crontab and make it run every week,
but i got AccessDeniedException : Sorry, only for admin user. Here is my script:
Code: Select all
when i change the parameter from token to null, ( eg. RepositoryExporter.exportDocuments(null, fldPath, file...........) )import java.io.File;
import java.io.FileOutputStream;
import java.io.StringWriter;
import com.openkm.util.impexp.RepositoryExporter;
import com.openkm.util.impexp.TextInfoDecorator;
import java.util.date;
import java.text.SimpleDateFormat;
import com.openkm.module.db.stuff.DbSessionManager;
String token = DbSessionManager.getInstance().getSystemToken();
SimpleDateFormat df = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss");
File file = new File("C:/okmbackup/"+ df.format(new Date()));
// OpenKM root
String fldPath = "/okm:root";
StringWriter out = new StringWriter();
//create folder
file.mkdir();
RepositoryExporter.exportDocuments(token, fldPath, file, true, true, out, new TextInfoDecorator(fldPath));i can run it normally when i click the Execute button ( flash icon ), but it cannot run automatically, i will get a message : nullPointerException,
So, how can i get the admin right to run those script ?
ps. I am using openkm 6.2.5
