jb-bgproc

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

bgproc CLI

bgproc CLI

Simple process manager for agents. All commands output JSON to stdout.
一款面向Agent的轻量进程管理器。所有命令均向标准输出(stdout)输出JSON格式内容。

Quick usage

快速上手

bash
bgproc start -n myserver -- npm run dev
bash
bgproc start -n myserver -- npm run dev

Commands

命令列表

  • start: Start a background process
  • status: Get status of a background process (pid, open ports)
  • logs: View logs for a background process
  • stop: Stop a background process
  • list: List all background processes
  • clean: Remove dead processes and their logs
  • start: 启动后台进程
  • status: 获取后台进程的状态(pid、开放端口)
  • logs: 查看后台进程的日志
  • stop: 停止后台进程
  • list: 列出所有后台进程
  • clean: 移除已终止的进程及其日志

start

start命令详情

bash
bgproc start -n <name> [-f] [-t <seconds>] [-w [<seconds>]] [--keep] -- <command...>
Notes:
  • -n <name>
    : Name the process (required)
  • -f
    : Force start if name exists
  • -t <seconds>
    : Timeout before considering start failed
  • -w [<seconds>]
    : Wait for the process to become ready; optional seconds
  • --keep
    : Keep logs after stop
  • --
    : Separator before the command to run
bash
bgproc start -n <name> [-f] [-t <seconds>] [-w [<seconds>]] [--keep] -- <command...>
说明:
  • -n <name>
    : 为进程命名(必填)
  • -f
    : 若进程名称已存在,强制启动
  • -t <seconds>
    : 启动超时时间,超过该时间则判定启动失败
  • -w [<seconds>]
    : 等待进程就绪;可选参数为等待秒数
  • --keep
    : 进程停止后保留日志
  • --
    : 待执行命令的分隔符

Other commands

其他命令示例

bash
bgproc status -n <name>
bgproc logs -n <name>
bgproc stop -n <name>
bgproc list
bgproc clean
bash
bgproc status -n <name>
bgproc logs -n <name>
bgproc stop -n <name>
bgproc list
bgproc clean

Tips

使用技巧

  • Parse JSON output to extract pid, ports, and status fields.
  • Use
    bgproc clean
    to remove stale entries and logs.
  • 解析JSON输出以提取pid、端口和状态字段。
  • 使用
    bgproc clean
    移除失效条目和日志。