Enterprise

# Driver CLI reference

> The commands and flags of the synnax-driver program.

The service commands are `install`, `uninstall`, `start` without `--standalone`, `stop`, `restart`, `status`, and `logs`. Run them with admin rights: with `sudo` on Linux and macOS, and in an administrator terminal on Windows. On NI Linux Real-Time, log in as `admin`, which is root, and leave out `sudo` in the commands below.

Each command accepts `--debug` for debug logs and `--no-color` for logs with no color.

## install

Installs the Driver as a service.

```bash
sudo synnax-driver install
```

* **Linux** -> creates the `synnax` system user, the environment file `/etc/synnax/driver.env`, and the systemd service `synnax-driver`. The service runs as the `synnax` user. It starts with the computer only after you run `sudo systemctl enable synnax-driver`. The service can use real-time priority and lock memory, and `install` writes the udev rule `/etc/udev/rules.d/99-synnax-driver-latency.rules`, so that [Arc automations at the High level](https://docs.synnaxlabs.com/reference/control/arc/timing#performance-levels) can keep CPU cores awake. `install` copies the binary to `/var/lib/synnax-driver/bin/`, which the `synnax` user owns, and makes `/usr/local/bin/synnax-driver` a link to it.
* **NI Linux Real-Time** -> creates the service `/etc/init.d/synnax-driver`, which runs as root and starts with the controller. `install` copies the binary to `/usr/local/bin`, and does not start the service, so run `synnax-driver start`. The Driver writes its logs to `/var/log/synnax-driver.log`.
* **Windows** -> copies the binary to `C:\Program Files\Synnax Driver\` and creates the service `SynnaxDriver`, which runs that copy as LocalSystem and starts with the computer. Windows restarts it when it stops with an error. The Driver writes its logs to `C:\ProgramData\synnax-driver\logs\driver.log`.
* **macOS** -> copies the binary to `/Library/Application Support/synnax-driver/bin/`, and creates the launchd service `com.synnaxlabs.driver` in `/Library/LaunchDaemons` and the environment file `/etc/synnax/driver.env`. The service runs that copy as root and starts with the computer. launchd restarts it when it stops with an error. The Driver writes its logs to `/Library/Logs/synnax-driver.log`.

`install` does not start the service. When the service already exists, `install` stops it first. On Linux, run `systemctl enable` and `start` again after you install again. On Windows and macOS, `install` also moves the [login of the user](https://docs.synnaxlabs.com/reference/enterprise/driver/configuration#state-file) to the service.

## login

Asks for the address of the Core, the username, and the password. It creates a rack for the Driver and an API key for that rack, and saves only the key in the [state file](https://docs.synnaxlabs.com/reference/enterprise/driver/configuration#state-file).

```bash
sudo synnax-driver login
```

```plaintext
Host [localhost]: 10.0.0.45
Port [9090]:
Secure (Y/N) [N]:
Username: driver
Password:
```

Run `login` with admin rights, so that the service reads the login. On Linux, and on macOS while the service is installed, `login` also reads the [environment file](https://docs.synnaxlabs.com/reference/enterprise/driver/configuration#environment-file), which only root can read. Restart a running Driver to use the new key.

| Flag           | Default                                                                                            | Description                 |
| -------------- | -------------------------------------------------------------------------------------------------- | --------------------------- |
| `--state-file` | see [State file](https://docs.synnaxlabs.com/reference/enterprise/driver/configuration#state-file) | The path of the state file. |

## start

Starts the service:

```bash
sudo synnax-driver start
```

With `--standalone`, runs the Driver in the terminal instead:

```bash
synnax-driver start --standalone
```

The flags below apply only with `--standalone`. `--standalone`, `--disable-sig-stop`, and `--disable-stdin-stop` take no value: they turn on when they are present. The other flags take a value, as `--port 9091` or `--port=9091`. For a boolean value, use `true` or `false`.

* [`--standalone`, `-s`](https://docs.synnaxlabs.com/reference/enterprise/driver/cli-reference#standalone)`= false`

  Run the Driver in the terminal, not as a service.

* [`--disable-sig-stop`](https://docs.synnaxlabs.com/reference/enterprise/driver/cli-reference#disable-sig-stop)`= false`

  Keep the Driver running when it gets SIGINT or SIGTERM.

* [`--disable-stdin-stop`](https://docs.synnaxlabs.com/reference/enterprise/driver/cli-reference#disable-stdin-stop)`= false`

  Do not stop the Driver when you type `STOP` in the terminal. Use this flag when the Driver runs with no terminal.

* [`--config`](https://docs.synnaxlabs.com/reference/enterprise/driver/cli-reference#config)

  The path of a [configuration file](https://docs.synnaxlabs.com/reference/enterprise/driver/configuration#configuration-file).

* [`--state-file`](https://docs.synnaxlabs.com/reference/enterprise/driver/cli-reference#state-file)

  The path of the state file. The default depends on the operating system. See [State file](https://docs.synnaxlabs.com/reference/enterprise/driver/configuration#state-file).

* [`--host`](https://docs.synnaxlabs.com/reference/enterprise/driver/cli-reference#host)`= localhost`

  The host of the Core.

* [`--port`](https://docs.synnaxlabs.com/reference/enterprise/driver/cli-reference#port)`= 9090`

  The port of the Core.

* [`--api-key`](https://docs.synnaxlabs.com/reference/enterprise/driver/cli-reference#api-key)`= ""`

  The API key of the Driver’s rack. The Driver logs in as that rack.

* [`--username`](https://docs.synnaxlabs.com/reference/enterprise/driver/cli-reference#username)`= synnax`

  The username to log in with once, to create a rack and its API key. Ignored when an API key is set.

* [`--password`](https://docs.synnaxlabs.com/reference/enterprise/driver/cli-reference#password)`= seldon`

  The password to log in with once, to create a rack and its API key. Ignored when an API key is set.

* [`--secure`](https://docs.synnaxlabs.com/reference/enterprise/driver/cli-reference#secure)`= false`

  Connect to the Core over TLS. Takes a value: `--secure true`.

* [`--correct-skew`](https://docs.synnaxlabs.com/reference/enterprise/driver/cli-reference#correct-skew)`= true`

  Keep the timestamps of hardware-timed NI and LabJack reads in step with the clock of the computer. Takes a value.

* [`--op-timeout`](https://docs.synnaxlabs.com/reference/enterprise/driver/cli-reference#op-timeout)`= 60`

  The number of seconds after which a task operation that has not finished gives the task the error `operation timed out`.

* [`--poll-interval`](https://docs.synnaxlabs.com/reference/enterprise/driver/cli-reference#poll-interval)`= 1`

  The number of seconds between two checks for task operations that have not finished.

* [`--shutdown-timeout`](https://docs.synnaxlabs.com/reference/enterprise/driver/cli-reference#shutdown-timeout)`= 30`

  The number of seconds that the Driver waits for task operations when it stops.

* [`--worker-count`](https://docs.synnaxlabs.com/reference/enterprise/driver/cli-reference#worker-count)`= 4`

  The number of threads that run task operations, from 1 to 64.

* [`--enable-integrations`](https://docs.synnaxlabs.com/reference/enterprise/driver/cli-reference#enable-integrations)

  Integrations to add, separated by commas: `arc`, `ethercat`, `http`, `labjack`, `modbus`, `ni`, or `opc`.

* [`--disable-integrations`](https://docs.synnaxlabs.com/reference/enterprise/driver/cli-reference#disable-integrations)

  Integrations to remove, separated by commas. For example, `--disable-integrations ni,labjack`.

The service ignores these flags. To configure the service, see [Configure a standalone Driver](https://docs.synnaxlabs.com/reference/enterprise/driver/configuration).

## stop

Stops the service.

```bash
sudo synnax-driver stop
```

## restart

Stops and starts the service. Run it after `login`, or after you edit the environment file.

```bash
sudo synnax-driver restart
```

## status

Shows whether the service runs.

```bash
synnax-driver status
```

* **Linux** -> prints the output of `systemctl status synnax-driver`. When the service does not run, the command fails with `Service is not running`.
* **NI Linux Real-Time and Windows** -> prints `Synnax Driver is running (PID: 28191)`, or `Synnax Driver is not running`.
* **macOS** -> prints the output of `launchctl print system/com.synnaxlabs.driver`.

## logs

Shows the logs of the service, and the new logs as they come, until you press Ctrl+C.

```bash
synnax-driver logs
```

On Linux, the command runs `journalctl -fu synnax-driver`. On NI Linux Real-Time, Windows, and macOS, it shows the log file that [install](https://docs.synnaxlabs.com/reference/enterprise/driver/cli-reference#install) names.

## clear

Deletes the saved connection parameters and API key from the state file. Run `login` again before the next start.

```bash
sudo synnax-driver clear
```

| Flag           | Default                                                                                            | Description                 |
| -------------- | -------------------------------------------------------------------------------------------------- | --------------------------- |
| `--state-file` | see [State file](https://docs.synnaxlabs.com/reference/enterprise/driver/configuration#state-file) | The path of the state file. |

## uninstall

Removes the service.

```bash
sudo synnax-driver uninstall
```

On Linux, Windows, and macOS, `uninstall` stops the service first. On Linux, it also removes the udev rule. On NI Linux Real-Time, it does not stop the service, so run `synnax-driver stop` before `uninstall`. The binary, the `synnax` user, the environment file, and the state file stay on the computer.

## version

Prints the version of the Driver.

```bash
synnax-driver version
```
