com um clique
systemd
创建和管理 systemd 服务单元文件,处理服务启动、重启和日志
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Menu
创建和管理 systemd 服务单元文件,处理服务启动、重启和日志
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
生成或审计模块的 SPEC.md。使用场景:用户要求"给 XX 模块写 spec"、"审计所有 spec"、"检查 spec 是否过期"。
Automates SailFish release workflow: fix build/type errors, update CHANGELOG (EN + CN), run npm version with pre/post hooks. Use when the user asks to release, 发版, 发布, bump version, or update changelog.
后端代码修改后,通过 CLI 测试验证功能正确性。使用场景:修改了 electron/services/ 下的代码需要测试、准备提交代码前跑回归、用户要求"跑测试"/"验证一下"。
完成新功能开发或较大修改后,使用本机 Claude CLI 进行代码审查。
使用 ts-morph 静态分析工具查询代码结构(类层次、方法签名、引用、依赖等),替代手动读源码。使用场景:需要了解类的方法/属性、继承链、符号引用、文件结构、依赖关系时。
When committing or staging changes, only include files related to the current task or conversation; do not stage or commit unrelated modifications. Use when the user asks to commit, stage, 提交, or when preparing to run git add/commit.
Baseado na classificação ocupacional SOC
| name | Systemd 服务管理 |
| description | 创建和管理 systemd 服务单元文件,处理服务启动、重启和日志 |
| version | 1.0 |
在 Linux 系统上创建和管理 systemd 服务的最佳实践。
路径:/etc/systemd/system/<service-name>.service
[Unit]
Description=My Application Service
After=network.target
Wants=network-online.target
[Service]
Type=simple
User=appuser
Group=appuser
WorkingDirectory=/opt/myapp
ExecStart=/opt/myapp/start.sh
Restart=on-failure
RestartSec=5
StandardOutput=journal
StandardError=journal
# 安全加固
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/opt/myapp/data
# 资源限制
LimitNOFILE=65535
MemoryMax=512M
[Install]
WantedBy=multi-user.target
| 操作 | 命令 |
|---|---|
| 启动 | systemctl start <service> |
| 停止 | systemctl stop <service> |
| 重启 | systemctl restart <service> |
| 平滑重载 | systemctl reload <service> |
| 查看状态 | systemctl status <service> |
| 开机自启 | systemctl enable <service> |
| 取消自启 | systemctl disable <service> |
| 查看日志 | journalctl -u <service> -f |
.service 文件到 /etc/systemd/system/systemctl daemon-reloadsystemctl start <service>systemctl status <service> 确认运行正常systemctl enable <service> 设置开机自启.service 文件systemctl daemon-reload(必须!)systemctl restart <service>systemctl status <service> — 查看当前状态和最近日志journalctl -u <service> -n 50 --no-pager — 查看最近 50 行日志journalctl -u <service> --since "1 hour ago" — 按时间范围查看daemon-reloadkill -9 停止 systemd 管理的服务Restart=on-failure 和合理的 RestartSecjournalctl 而非手动管理日志文件