Repository navigation
Create 没有systemd.md #697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Create 没有systemd.md #697
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| 没有 systemd | ||
| cd /var/www/Agent2API | ||
|
|
||
| # 1.(可选)带 Cloudflare Tunnel 的话先配环境变量 | ||
| # 数据目录要落在一个持久化挂载上,否则容器重建数据丢失 | ||
| export AGENT2API_DATA_DIR=/var/www/Agent2API/data | ||
|
|
||
| # 2. 前台跑(先验证能不能起来) | ||
| mkdir -p /var/www/Agent2API/data | ||
| ./agent2api-server | ||
|
Comment on lines
+9
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 将命令放入代码块 渲染后的 Markdown 会将这两行合并显示。用户复制后, 请用代码块包住各步骤的命令,保留原始换行和反斜杠。As per path instructions,“检查 UI 展示、错误提示和默认值是否符合用户直觉”。
|
||
|
|
||
| # 3. 能起来后 Ctrl+C,改用后台常驻(不依赖 systemd 的经典方式) | ||
| cd /var/www/Agent2API | ||
|
|
||
| AGENT2API_DATA_DIR=/var/www/Agent2API/data \ | ||
| AGENT2API_CLOUDFLARED_ENABLED=1 \ | ||
| AGENT2API_CLOUDFLARED_TOKEN="eyJhbGciOi...(控制台复制的整串)" \ | ||
|
Comment on lines
+16
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 文档中的 Tunnel 配置不会生效 第 16–17 行设置的 请删除这两个变量,并把第 4 行中关于 Tunnel 的说明删掉。若以后要支持 Tunnel,应先在服务端实现,再写入文档。 建议修改
|
||
| nohup ./agent2api-server > /var/www/Agent2API/server.log 2>&1 & | ||
| echo $! > /var/www/Agent2API/server.pid | ||
|
|
||
|
|
||
| # 4.停服务时别只 kill 二进制——它是父进程,Tunnel 子进程会跟着退出,直接: | ||
| kill $(cat /var/www/Agent2API/server.pid) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
文档中的
AGENT2API_DATA_DIR没有生效,数据可能不在持久化挂载上。第 6 行和第 15 行设置
AGENT2API_DATA_DIR,目的是把数据放到持久化挂载上。仓库中没有任何代码读取这个变量。按文档操作时,数据可能写入默认位置,容器重建后会丢失。请先确认服务端实际读取的数据目录配置。然后把这两处
AGENT2API_DATA_DIR替换为该配置,并确保它指向持久化挂载路径。packaging/linux/install.sh使用的数据目录是/var/lib/agent2api,与本文档的/var/www/Agent2API/data不同,文档应说明两者的区别。