系统清理技能

# 系统清理技能 (System Cleanup Skill)

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "系统清理技能" with this command: npx skills add mickey3721/system-cleanup

系统清理技能 (System Cleanup Skill)

简介

一个用于定期清理和维护OpenClaw系统的技能,包括清理临时文件、备份文件、日志文件,以及优化系统性能。

适用场景

当用户要求执行系统清理、维护、优化或清理磁盘空间时使用此技能。

核心功能

1. 配置文件备份清理

  • 清理旧的 .bak, .backup, .clobbered 备份文件
  • 保留最新的2-3个备份文件
  • 清理vim交换文件 (.swp, .swx)

2. 临时文件清理

  • 清理 /tmp 目录中的OpenClaw相关临时文件
  • 清理工作空间中的临时文件
  • 清理超过指定时间的缓存文件

3. 会话管理

  • 检查并清理旧的会话文件
  • 清理超过7天的会话记录
  • 检查会话文件大小并报告

4. 磁盘使用分析

  • 分析OpenClaw目录的磁盘使用情况
  • 识别最大的文件/目录
  • 提供清理建议

5. 系统状态检查

  • 检查Gateway服务状态
  • 验证服务配置
  • 检查安全警告

使用指南

基本命令

# 检查当前系统状态
openclaw gateway status

# 清理旧的备份文件
find ~/.openclaw -name "*.bak.*" -name "*.backup.*" -name "*.clobbered.*" -mtime +7 -delete

# 清理临时文件
find ~/.openclaw -name "*.swp" -name "*.swx" -delete
find /tmp -name "*openclaw*" -mtime +1 -delete 2>/dev/null

维护脚本

在技能目录中已包含一个维护脚本:

  • scripts/cleanup.sh - 系统清理脚本

定期清理

建议每周执行一次系统清理,或在磁盘空间不足时执行。

配置选项

保留策略

  • 备份文件:保留最新的3个
  • 日志文件:保留最近7天
  • 会话文件:保留最近14天

安全设置

  • 不删除当前使用的文件
  • 先列出待删除文件,再确认删除
  • 可配置安全级别

示例执行步骤

# 1. 检查系统状态
openclaw gateway status

# 2. 分析磁盘使用
du -sh ~/.openclaw
du -sh ~/.openclaw/* 2>/dev/null | sort -h

# 3. 列出可清理的文件
find ~/.openclaw -name "*.bak.*" -type f 2>/dev/null | sort

# 4. 执行清理(谨慎操作)
# find ~/.openclaw -name "*.bak.*" -mtime +7 -delete

注意事项

⚠️ 重要提示

  1. 在删除任何文件前,先列出文件确认
  2. 确保不删除当前正在使用的文件
  3. 保留足够的备份文件供恢复使用
  4. 清理前建议备份重要数据

集成建议

与HEARTBEAT集成

可将系统清理作为定期心跳任务的一部分,每周执行一次。

与cron集成

可设置定期清理任务:

# 每周一早上3点执行清理
0 3 * * 1 /path/to/system-cleanup/scripts/cleanup.sh

版本历史

  • v1.0 (2026-03-27): 基础系统清理功能

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Openclaw Video Editor

Pro-Studio v4.0.0. AI-powered background removal, smart subtitle placement, and cinematic LUT presets. The ultimate production suite for high-end video content.

Registry SourceRecently Updated
General

IOC 智能巡检报告

为 IOC(智能运营中心)生成智能巡检报告。自动分析设备状态、报警记录、能耗数据,生成专业的巡检日报/周报。支持连接 PostgreSQL 数据库读取实时数据,输出 Markdown/HTML 报告。适用于物业管理、商业综合体、工业园区等场景。

Registry SourceRecently Updated
General

Expert Library Plus Skill

Install and manage Expert Library Plus - the world's first AI expert library with name-based quality anchors. Enhances 43+ professional experts with historic...

Registry SourceRecently Updated
General

Api Gateway 1.0.46

Connect to 100+ APIs (Google Workspace, Microsoft 365, Notion, Slack, Airtable, HubSpot, etc.) with managed OAuth. Use this skill when users want to interact...

Registry SourceRecently Updated