---
title: Running local command line scripts
---

> [!WARNING]
> Legacy documentation: This documentation applies to **Legacy Deephaven Enterprise only** and does not apply to Core+.

Deephaven provides a utility for running local "one-and-done" scripts via the command line. This function is accessible via `iris_exec` as follows:

`/usr/illumon/latest/bin/iris_exec run_local_script [<launch args>] -- -s script.groovy [<options>] [<variable> <value>, …]`

## Options

The `-s` option specifying the script file is required. There are other options as described below.

| Option | Req?              | Default                                                            | Description                                                                                                                                                                                                  |
| ------ | ----------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `-s`   | Yes               | N/A                                                                | Script file to run                                                                                                                                                                                           |
| `-m`   | No                | 4                                                                  | Worker heap size in GB                                                                                                                                                                                       |
| `-l`   | No                | INFO                                                               | Local log level - the log level to apply locally. Server messages are also affected; they will be logged locally with a `[SERVER]` prefix if they match the specified priority at the server and the client. |
| `-r`   | No                | The same as that specified for Local (INFO if not specified).      | Remote log level - the log level to apply in the server when running the script.                                                                                                                             |
| `-t`   | No                | Auto-detect from file extension                                    | Session/script type. Presently supported is "Groovy" or "Python".                                                                                                                                            |
| `-o`   | No                | N/A                                                                | File to which script standard output should be directed. This output is also directed to the standard log, but this allows you to get a "clean" output from the script.                                      |
| `-e`   | No                | N/A                                                                | File to which script standard error should be directed. This output is also directed to the standard log, but this allows you to get a "clean" output from the script.                                       |
| `-sp`  | No                | Initial script location                                            | Directory from which scripts should be sourced[\*](#note-1)                                                                                                                                                  |
| `-k`   | No[\*\*](#note-2) | `IRIS_KEYFILE` environment variable                                | Deephaven private key file                                                                                                                                                                                   |
| `-h`   | No                | `RemoteQueryDispatcherParameters.host` configuration property      | Query server host on which to run the script.                                                                                                                                                                |
| `-p`   | No                | `RemoteQueryDispatcherParameters.queryPort` configuration property | Query server port on which to run the script.                                                                                                                                                                |
| `-tds` | Yes               | N/A                                                                | Set table data service source. This can be any TDS configured in the data routing file. Common values are “query” and “local”.                                                                               |
| `-j`   | Yes               | N/A                                                                | Add JVM arguments. Note: This takes full JVM argument after it; e.g., `-j -Dorg.roaringbitmap.ImmutableContainer.enabled=true`                                                                               |
| `-jp`  | Yes               | N/A                                                                | Select a JVM profile. Note: A JVM profile name with spaces in it can be enclosed in double-quotes.                                                                                                           |

### Note 1

You can include common functionality in your Groovy scripts with the `source("stuff.groovy")` command. These scripts are sourced from the client filesystem relative to the initial script (or the location specified with the `-sp` option, if present).

### Note 2

Running a script on the Deephaven query server requires authentication which is provided by a private key file. You may set the path to this file in the environment variable `IRIS_KEYFILE` or specify it on the command line with the `-k` option. If present, the option overrides the environment variable.

### Note 3

While this command executes a script located on the client filesystem, it is run on a Deephaven server, typically by the dbquery or dbmerge user, so resources on the client system are not typically available, with the exception of other scripts, via the source command.

### Note 4

This command also accepts positional arguments representing values that will be bound as global variables in the specified script. For example, the following will run the script `fun.groovy` with the variable `msg` bound to the value `"Hello World"` and pi to 3.14159 (both as strings).

`/usr/illumon/latest/bin/iris_exec run_script -- -s fun.groovy msg "Hello World" pi 3.14159`
