Appearance
hook test —— 本地试运行
使用模拟数据在本机试运行 hook,不改动真实证书,CertiMan 本身不访问网络。用于验证 hook 脚本自身的逻辑。
present 步骤成功后自动执行 cleanup,模拟一次完整的 DCV 流程。
用法
bash
certiman hook test [flags]参数
| flag | 短名 | 类型 | 默认 | 说明 |
|---|---|---|---|---|
--domain | -d | []string | 选择器:按主域名指定本机证书,以其配置作为数据来源 | |
--conf | -c | string | 选择器:证书配置文件路径 | |
--step | string | present | 试运行步骤:present / cleanup / deploy | |
--keep | bool | false | 仅对 --step present 有效:present 成功后不自动执行 cleanup,便于在 DNS 服务商控制台手动核对记录 |
示例
bash
# 试运行 present(成功后自动执行 cleanup)
certiman hook test -d example.com
# 只试运行 deploy
certiman hook test -d example.com --step deploy
# 用外部配置文件
certiman hook test -c ./shop-cert.yaml --step present输出
hook 未被执行时(退出码 126 / 127)
路径错误、脚本缺少执行权限(未执行 chmod +x)、在 Windows 上使用 shebang 脚本等问题,在 hook test 中会以退出码 126(不可执行)或 127(不存在)体现。含义与建议动作见 Hook 环境变量 · 退出码 126 与 127。
正式流程中的 hook 输出写入日志
由 issue、renew、cron 等命令触发的 hook,其 stdout / stderr 会按行写入 ~/.certiman/logs/cc-YYYY-MM.log。定时任务执行失败时,可用 tail 查看该日志中的脚本原始输出。
