Skip to content

Commit

Permalink
DOCS-1521: Document Execute Once process behavior (#2381)
Browse files Browse the repository at this point in the history
  • Loading branch information
JessamyT authored Jan 12, 2024
1 parent 762ea24 commit 9d6453c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
17 changes: 9 additions & 8 deletions docs/build/configure/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,17 +227,18 @@ Find more information in our [remotes documentation](/build/configure/parts-and-

To automatically run a specified script when the machine boots, configure a _process_.

Start by giving the process a **Name** (`id` in raw JSON) (an identifier of your choice) and clicking **Create Process**.
Start by giving the process a **Name** (`id` in raw JSON) (an identifier of your choice) and clicking **Create process**.

Then fill in the following fields:

- **Executable** (`name`): The command you want to execute when your machine connects to the server.
- **Arguments** (`args`): Optional arguments to follow the command.
- **Working Directory** (`cwd`): Where you want the process to execute.
An optional setting that defaults to the directory where `viam-server` executes.

You can also toggle whether you want errors and other messages to be logged, and whether to execute the command just once or keep running the process indefinitely.
In raw JSON, these options are represented by `log` (bool) and `one_shot` (bool), respectively.
<!-- prettier-ignore -->
| Attribute (Builder Mode) | Attribute (Raw JSON) | Type | Inclusion | Description |
| ------------------------ | -------------------- | ------- | ------------ | ----------- |
| Executable | `name` | string | **Required** | The command you want to execute when your machine connects to the server. |
| Arguments | `args` | string | Optional | Arguments to follow the command. |
| Working directory | `cwd` | string | Optional | Where you want the process to execute. Defaults to the directory where `viam-server` executes. |
| Logging | `log` | boolean | Optional | Toggle logging of errors and other messages on or off. Default: `false`. |
| Execute once | `one_shot` | boolean | Optional | Toggle whether to execute the command just once or keep running the process indefinitely.<ul><li>If true, the process executes once at `viam-server` startup. Until the process completes, `viam-server` startup is blocked and the robot appears offline in the [Viam app](https://app.viam.com), so this should only be used for quick processes.</li><li>If false, the process continues to run. If the process crashes, it automatically restarts. It does not block `viam-server`. Default: `false`.</li></ul> |

{{% expand "Click to see an example of a configured process." %}}

Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/custom/custom-base-dog.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,11 @@ Fill out the config panel as follows:
- **Arguments**: Type in `main.py` and click **Add argument**.
Then type `-tn` and click **Add argument** again.
This flag starts the Freenove server without launching Freenove's GUI (which you don't need for this use case).
- **Working Directory**: `/home/fido/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Server` (changing "/home/fido" to the name of your home directory where you downloaded the Freenove code).
- **Working directory**: `/home/fido/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Server` (changing "/home/fido" to the name of your home directory where you downloaded the Freenove code).
- **Logging**: Toggle to the **on** position so you can view logs for this server process.
- **Execute once**: Leave this **off** so that the Freenove server will continue to run, and will restart if it crashes.

Click **Save Config** at the bottom of the window.
Click **Save config** at the bottom of the window.

![Screenshot of the Processes subtab of the Config tab, showing a process configured as detailed above.](/tutorials/custom-base-dog/process-config.png)

Expand Down

0 comments on commit 9d6453c

Please sign in to comment.