All Nuxeo EP documentation versions

Nuxeo Platform 5.6
Nuxeo Platform 5.5
Nuxeo Enterprise Platform (EP) 5.4
Nuxeo Enterprise Platform (EP) 5.3

Nuxeo Enterprise Platform 5.4

This documentation relates to an old version of Nuxeo EP (5.4). You may want to check the latest version if you are using a more recent version.
Skip to end of metadata
Go to start of metadata

As I said in the overview section there are three modes to execute batch commands:

  1. Run commands from a file
  2. Run commands from standard input.
  3. Run commands specified on the command line - this is a convenient way to run a short list of commands.

Running Commands From a File

To run commands from a file you should use the -f parameter to specify a file containing commands when launching Nuxeo Shell.

Example:

Where my_batch_file is a file containing the commands to execute - each command on one line. Empty lines and lines beginning with # are ignored. The # character can be use to add comments to a batch file.

Here is an example of a batch file:

If you want to span a command on multiple lines (you may want this for improved readability in case of long commands) you can end the line with a * character (*make sure you don't have a space after **). In that case the command will continue on the next line, and so on until no more line ending ** is found or the end of file is reached.

Example:

Running Commands From Standard Input

If you want to run batch commands from the terminal standard input you can use the - option when launching the Nuxeo shell.
The format of the commands is the same as the one described when running commands from a file.

Here is an example which will run the commands from my_batch_file file by using the Unix cat application and pipes:

Running Batch Commands from the Command Line

If you just run a few short commands you can specify them directly in the command line of the Nuxeo Shell.

Example:

Note that commands are separated using a semicolon character.

Limitations

You cannot run that way commands that contains illegal characters and needs to be escaped.

Labels
  • None
  1. Apr 14, 2011

    Anonymous

    I am trying to use nuxeo shell in batch mode to execute a long-run groovy script but it fails after while with error message "Failed to run script". After some attempts I noticed that it always fails after 2 minutes, looks like a time-out. When the script succeeds, its execution duration was always under 2 miniutes.Do you know where I can adjust it ?

    Here is the content of my bash script :

    java -cp nuxeo-shell-5.4.1-I20110125_0115.jar org.nuxeo.shell.Main -e "connect -u Administrator -p ****** http://host/nuxeo/site/automation;script longrunscript.groovy -ctx