# CLI

> **弃用通知**
> 此页面描述的功能已从 Luxonis Hub 中移除或替换。功能可能受限，仅对 Hub Original 客户可用。请参考最新的指南来配置设备、管理集群和部署应用。

Luxonis Hub 代理带有一个命令行界面（CLI），允许您与代理及其连接的设备进行交互和管理。 本节介绍 CLI 的使用方法和可用命令。

要使用 CLI，打开终端并运行以下命令：

```bash
hubctl [command] [options]
```

将 [command] 替换为下面描述的可用命令之一，将 [options] 替换为任何适用的命令特定选项。

## 通用命令

version - 打印 Luxonis Hub 代理的版本。

示例：

```bash
$ hubctl version
Installed agent version: 24.55.1308
```

status - 打印 Luxonis Hub 代理的状态。

示例：

```bash
$ hubctl status
╔═══════════════════════════════════════════════════════════════╗
║                                                               ║
║ Luxonis Hub Agent (24.55.1308 | linux/arm64 | DepthAI 2.21.2) ║
║                                                               ║
╚═══════════════════════════════════════════════════════════════╝

Web UI                   https://localhost:9010
DepthAI                  2.21.2

Connected to cloud?      yes (https://hub.luxonis.com)
Team                     Luxonis
Pending detections       0

Link to robot in cloud
https://hub.luxonis.com/robots/00000000-0000-0000-0000-000000000000
```

start - 启动 Luxonis Hub 代理。

需要 root 权限

示例：

```bash
$ sudo hubctl start
```

stop - 停止 Luxonis Hub 代理。

需要 root 权限

示例：

```bash
$ sudo hubctl stop
```

restart - 重启 Luxonis Hub 代理。

需要 root 权限

示例：

```bash
$ sudo hubctl restart
```

startup - 启用或禁用 Luxonis Hub 代理在系统启动时自动启动。

参数：

 * enable 启用自动启动
 * disable 禁用自动启动

示例：

```bash
$ hubctl startup enable
```

logs - 显示 Luxonis Hub 代理的日志。

选项：

 * -f, --follow 不终止，持续跟踪日志（默认：false）
 * -a, --all 打印所有可用日志（建议通过管道传送到 less）（默认：false）
 * -l, --last <lines> 显示从末尾开始的多少行（默认："20"）
 * --since <linux date> 过滤自某个时间点之后的日志
 * --until <linux date> 过滤自某个时间点之前的日志
 * --format <json|pretty|plain> 选择日志格式（默认："pretty"）

示例：

```bash
$ hubctl logs
63 23:05:28  I  user/agent/hub-connection : received see_you
63 23:05:31  I  user/agent/apps/logs : uploading app logs to RH | pending -> 0
63 23:05:36  I  user/agent/apps/logs : uploading app logs to RH | pending -> 0
63 23:05:41  I  user/agent/apps/logs : uploading app logs to RH | pending -> 0
```

upload-support - 将支持文件上传到 Luxonis。 请将末尾打印的哈希值提供给我们的支持团队。

示例：

```bash
$ hubctl upload-support
File has been uploaded with hash: f0a83c01bc4c7c7f0bd466d6cca2ec9071f8c267e6e65385f744e94f1caa734d
```

reset - 将 Luxonis Hub 代理重置为安装后状态。

需要 root 权限

示例：

```bash
$ sudo hubctl reset --i-understand-consequences --keep-robot-in-cloud
```

## 云命令

cloud connect - 将 Luxonis Hub 代理连接到 Luxonis Hub。

示例：

```bash
$ hubctl cloud connect
Already connected to cloud (team Luxonis). Disconnect first to connect again.
hubctl cloud disconnect
```

cloud disconnect - 断开 Luxonis Hub 代理与 Luxonis Hub 的连接。

示例：

```bash
$ hubctl cloud disconnect
```

cloud force-sync - 强制手动与 Luxonis Hub 同步。

示例：

```bash
$ hubctl cloud force-sync
```

## 设备命令

devices - 显示连接到 Luxonis Hub 代理的设备列表。

示例：

```bash
$ hubctl devices
┌────────────────────┬────────────────────┬───────────────────────┬──────────┬─────────┬──────────────────┬──────┐
│ serial             │ name               │ product               │ location │ status  │ connectionStatus │ app  │
├────────────────────┼────────────────────┼───────────────────────┼──────────┼─────────┼──────────────────┼──────┤
│ 18443010116C870E00 │ 18443010116C870E00 │ OAK-D-PRO-FF (DM9098) │ USB 2.1  │ success │ ready            │ none │
└────────────────────┴────────────────────┴───────────────────────┴──────────┴─────────┴──────────────────┴──────┘
```

## 应用命令

apps list - 显示已安装应用的列表。

示例：

```bash
$ hubctl apps list
┌──────────────────────────────────────┬─────────┬─────────┬──────────────────────────┬────────────┐
│ id                                   │ type    │ status  │ started at               │ stopped at │
├──────────────────────────────────────┼─────────┼─────────┼──────────────────────────┼────────────┤
│ bfeb4f73-f503-458a-8c24-b88258f9523a │ builtin │ Running │ 2024-03-01T08:15:33.282Z │            │
└──────────────────────────────────────┴─────────┴─────────┴──────────────────────────┴────────────┘
```
