How to run scripts in cron?

Version 2023.02.07 released a script named dspacerestprocess, which has been introduced, in order to run DSpace processes from CLI directly as they were requested from the UI.

In order to use the dspacerestprocess property, it should be set in the local.cfg with a machine token: dspace.cli.jwt =

To use the machine token it is important to have configured the property

jwt.login.token.secret = <some random generated complex string>

in the local.cfg.

This property must be set and tomcat restarted before that the machine token can be generated otherwise this token will became invalid as soon as tomcat is restarted

Please note that the dspacerestprocess script requires a slightly different format for the argument to pass to the script

  • normal parameters must be passed in the form -<key>=<value>, this include the case where the parameter doesn’t have any value (i.e. if you need to pass the option -b without any value you need to put -b=

  • a file parameter, if you need to provide a file as an input of the script make sure to have a -f=<file-name> parameter and a --file <path-to-the-file-on-the-server>

Test if scripts in cron work

Example: if you want to run the index-discovery task from the command line, you have to run the following command:

./dspacerestprocess index-discovery -b=

Please note the = after the -b that is required due to the differences in dealing with parameters, explained in the previous paragraph


  • No labels