self-dev-ubuntu-headless-browser
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "self-dev-ubuntu-headless-browser" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-10bbae7eb4448330082647c2c2509c5e7fb658bb4e9d81cbafef135802f7c160. Verify the upstream source and version against https://skillhub.cn/skills/user_f12a44b7/self-dev-ubuntu-headless-browser before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Configure the OpenClaw headless browser on Ubuntu to run around-the-clock (including nighttime) automated tasks. Covers systemd serviceization, Chromium installation and headless configuration, Cron/HEARTBEAT scheduling, and measures for long-running stability. Trigger keywords: headless browser, headless, long-running, nighttime automation, browser automation, VPS browser.
Introduction source: third_party · user_f12a44b7 · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: ubuntu-headless-browser
slug: self-dev-ubuntu-headless-browser
version: 1.0.0
displayName: "Self Dev Ubuntu Headless Browser"
description: 在 Ubuntu 上配置 OpenClaw 无头浏览器,实现全天候(含夜间)自动化任务。涵盖 systemd 服务化、Chromium 安装、headless 配置、Cron/HEARTBEAT 定时任务、挂机稳定性保障。触发关键词:无头浏览器、headless、挂机、夜间自动、browser automation、VPS浏览器。
requires:
bins: [curl, git]
env: []Ubuntu 无头浏览器自动化(OpenClaw 全天候挂机)
概述
本 Skill 提供在 Ubuntu(VPS/云主机)上让 OpenClaw 全天候运行浏览器自动化的完整配置方案。
核心三件套:
- systemd 服务化 — OpenClaw gateway 开机自启 + 崩溃自动拉起
- 无头浏览器 — headless + noSandbox + 可执行路径,无桌面也能跑
- 定时任务 — Cron(固定时间)或 HEARTBEAT(周期巡检),夜间自动干活
1. 禁止休眠/挂起
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
验证:
systemctl status sleep.target suspend.target
2. OpenClaw 安装 & 服务化
安装
curl -fsSL https://openclaw.ai/install.sh | bash
守护服务(推荐)
openclaw onboard --install-daemon
验证:
systemctl --user status openclaw-gateway.service
手动创建 systemd 服务(备用)
如果 --install-daemon 在 root 环境有问题:
OPENCLAW_BIN="$(command -v openclaw)"
mkdir -p /run/user/0
chmod 700 /run/user/0
export XDG_RUNTIME_DIR=/run/user/0
mkdir -p /root/.config/systemd/user
cat > /root/.config/systemd/user/openclaw-gateway.service <<EOF
[Unit]
Description=OpenClaw Gateway (user)
After=network.target
[Service]
Type=simple
Environment=XDG_RUNTIME_DIR=/run/user/0
Environment=OPENCLAW_HOME=/root/.openclaw
WorkingDirectory=/root/.openclaw
ExecStart=$OPENCLAW_BIN gateway start
Restart=always
RestartSec=2
[Install]
WantedBy=default.target
EOF
systemctl --user daemon-reload
systemctl --user enable --now openclaw-gateway.service
常用管理:
# 启动/停止/重启
systemctl --user start openclaw-gateway.service
systemctl --user stop openclaw-gateway.service
# 看日志
journalctl --user -u openclaw-gateway.service -n 50
3. 无头浏览器配置
安装 Chromium(二选一)
方案 A — Playwright 自带(推荐):
npx playwright install chromium
# 路径类似:/home/用户名/.cache/ms-playwright/chromium-XXX/chrome-linux/chrome
方案 B — 系统包:
sudo apt update && sudo apt install -y chromium-browser
# 路径:/usr/bin/chromium-browser 或 /snap/bin/chromium
OpenClaw 浏览器配置
编辑 ~/.openclaw/openclaw.json,在顶层添加 browser 段:
{
"browser": {
"enabled": true,
"defaultProfile": "openclaw",
"headless": true,
"noSandbox": true,
"executablePath": "/home/你的用户名/.cache/ms-playwright/chromium-1208/chrome-linux64/chrome",
"profiles": {
"openclaw": {
"cdpPort": 18792,
"color": "#FF6B00"
}
}
}
}
关键参数说明:
headless: true— 无图形界面必须noSandbox: true— 多数 Linux 云主机/容器需要关闭沙箱executablePath— 换成实际安装路径defaultProfile: "openclaw"— 托管模式,不需要扩展
或用 CLI 逐项设置:
openclaw config set browser.enabled true
openclaw config set browser.defaultProfile "openclaw"
openclaw config set browser.headless true
openclaw config set browser.noSandbox true
openclaw config set browser.executablePath "/home/用户名/.cache/ms-playwright/chromium-1208/chrome-linux64/chrome"
openclaw gateway restart
确保 browser 工具在白名单
{
"tools": {
"byProvider": {
"你的Provider名": {
"allow": ["read", "write", "edit", "web_search", "image", "browser"]
}
}
}
}
4. 验证浏览器
openclaw browser status
openclaw browser start
openclaw browser open https://www.baidu.com
返回 opened: https://www.baidu.com/ 即成功。
5. 夜间自动任务
5.1 Cron(固定时间触发)
openclaw cron add \
--name "night-auto-1" \
--cron "0 2 * * *" \
--tz "Asia/Shanghai" \
--session isolated \
--message "用浏览器打开 https://example.com,按流程抓取数据并保存到 ~/output/night.json,完成后发结果摘要" \
--announce \
--channel weixin:direct:你的ChatID
手动测试:
openclaw cron run night-auto-1
5.2 HEARTBEAT(周期巡检)
设置心跳间隔:
openclaw config set agents.defaults.heartbeat.every "30m"
编辑 ~/.openclaw/workspace/HEARTBEAT.md:
# 心跳任务
## 夜间浏览器自动化(23:00–05:00)
- 判断当前时间,不在 23:00–05:00 则跳过
- 在 23:00–05:00 时:
- 用浏览器打开目标网址,按流程抓取数据
- 追加到 ~/output/night-heartbeat.json
- 连续两次失败时立即告警
## 清理
- 删除 7 天前的 ~/output/night-heartbeat-*.log
6. 稳定性检查清单
| 项目 | 检查方式 |
|---|---|
| 服务状态 | systemctl --user status openclaw-gateway.service |
| 最近日志 | journalctl --user -u openclaw-gateway.service -n 100 --no-pager |
| 浏览器状态 | openclaw browser status |
| Cron 任务 | openclaw cron list |
| 休眠已禁 | systemctl status sleep.target |
常见问题
| 问题 | 解决方案 |
|---|---|
| 浏览器启动失败 | 确认 executablePath 正确 + noSandbox: true |
| cron 任务没跑 | 检查时区 --tz 是否与系统一致 |
| 内存不足被 OOM Kill | 检查 dmesg \| grep -i oom,考虑增加 swap |
| systemd --user 不工作 | 用备用的手动创建方案(第 2 节) |
| headless 截图空白 | 安装字体:sudo apt install fonts-noto-cjk |
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供完整的 Ubuntu 无头浏览器自动化配置方案,解决用户在 VPS 上运行浏览器自动化的核心痛点
- 涵盖 systemd 服务化、定时任务、稳定性保障等关键运维环节,实用性强
Highlights
- 触发关键词覆盖全面,包括无头浏览器、headless、挂机、夜间自动等,边界清晰
Areas to improve
-
缺少 When to Use 章节 Reported severity: Minor
文档结构完整但缺少明确的适用场景说明章节
Recommendation: 建议增加 When to Use 章节,明确说明本 Skill 最适合的使用场景和用户群体
-
缺少端到端完整示例 Reported severity: Minor
虽然有分步示例,但缺少一个完整的端到端使用案例
Recommendation: 建议增加一个完整的端到端示例,展示从安装到成功运行夜间自动化任务的完整流程
Highlights
- 文档结构清晰,分步骤详细说明操作流程
- frontmatter 完整,包含必要的元数据信息
Areas to improve
-
部分命令环境兼容性说明不足 Reported severity: Minor
openclaw onboard --install-daemon 等命令在特定环境下可能存在问题,但未充分说明
Recommendation: 建议增加更多关于不同环境(如 root 用户、不同 Linux 发行版)下的兼容性说明和替代方案
Highlights
- 提供了多种浏览器安装方案,提高兼容性
- 包含详细的验证命令和稳定性检查清单
- 覆盖了常见问题和解决方案
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 106, 112, 245 -
Administrator or elevated privileges
Elevate only when necessary. Keep protection and certificate validation enabled and avoid broad system access.
Mentioned in main document · lines 28, 112, 245
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- openclaw.ai
- www.baidu.com
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.