This documentation refers to the unreleased development version of the Nuxeo Platform. For the current production version, refer to the 5.6 documentation.
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 begining 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.

Related pages
Page: Nuxeo Shell (Nuxeo Installation and Administration)
Page: Nuxeo Shell Command Index (Nuxeo Installation and Administration)
Page: Built-in Commands (Nuxeo Installation and Administration)
Page: Nuxeo Automation Commands (Nuxeo Installation and Administration)
Page: Filesystem Commands (Nuxeo Installation and Administration)
Page: Nuxeo Server Commands (Nuxeo Installation and Administration)
Page: Nuxeo Shell Batch Mode (Nuxeo Installation and Administration)
Page: Shell Commands (Nuxeo Enterprise Platform (EP))
Page: Shell Features (Nuxeo Enterprise Platform (EP))
Page: Extending The Shell (Nuxeo Enterprise Platform (EP))
Page: Shell Documentation (Nuxeo Enterprise Platform (EP))
Page: Shell Namespaces (Nuxeo Enterprise Platform (EP))
Page: Configuration Commands (Nuxeo Installation and Administration)
Labels
  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