[DSC-93] Added help to ProcessCleaner

This commit is contained in:
Luca Giamminonni
2022-09-15 15:48:04 +02:00
parent e96107a6b9
commit a111152ea0
3 changed files with 17 additions and 4 deletions

View File

@@ -34,17 +34,18 @@ import org.dspace.utils.DSpace;
*/
public class ProcessCleaner extends DSpaceRunnable<ProcessCleanerConfiguration<ProcessCleaner>> {
private ConfigurationService configurationService;
private ProcessService processService;
boolean cleanCompleted = false;
private boolean cleanCompleted = false;
boolean cleanFailed = false;
private boolean cleanFailed = false;
boolean cleanRunning = false;
private boolean cleanRunning = false;
private boolean help = false;
private Integer days;
@@ -55,6 +56,7 @@ public class ProcessCleaner extends DSpaceRunnable<ProcessCleanerConfiguration<P
this.configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
this.processService = ScriptServiceFactory.getInstance().getProcessService();
this.help = commandLine.hasOption('h');
this.cleanFailed = commandLine.hasOption('f');
this.cleanRunning = commandLine.hasOption('r');
this.cleanCompleted = commandLine.hasOption('c') || (!cleanFailed && !cleanRunning);
@@ -70,6 +72,11 @@ public class ProcessCleaner extends DSpaceRunnable<ProcessCleanerConfiguration<P
@Override
public void internalRun() throws Exception {
if (help) {
printHelp();
return;
}
Context context = new Context();
try {

View File

@@ -40,6 +40,8 @@ public class ProcessCleanerConfiguration<T extends ProcessCleaner> extends Scrip
Options options = new Options();
options.addOption("h", "help", false, "help");
options.addOption("r", "running", false, "delete the process with RUNNING status");
options.getOption("r").setType(boolean.class);

View File

@@ -1542,6 +1542,10 @@ solr-database-resync.time-until-reindex = 600000
# Keep in mind, changing the schedule requires rebooting your servlet container, e.g. Tomcat.
solr-database-resync.cron = 0 15 2 * * ?
## PROCESS CLEANER SCRIPT
# Defines how many days to go back from the current date to find out which old processes to delete (default is 14)
# process-cleaner.days = 14
#------------------------------------------------------------------#
#-------------------MODULE CONFIGURATIONS--------------------------#
#------------------------------------------------------------------#