nezhahq.github.io/assets/guide_tasks.md.cdc60267.js

2 lines
3.6 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as e,o,c as a,R as c}from"./chunks/framework.1625126e.js";const u=JSON.parse('{"title":"","description":"","frontmatter":{"outline":"deep"},"headers":[],"relativePath":"guide/tasks.md","filePath":"guide/tasks.md","lastUpdated":1694095078000}'),d={name:"guide/tasks.md"},t=c('<p><strong>在任务区域中,可以设置计划任务,触发任务,多服务器批量执行任务</strong></p><p>哪吒监控支持推送命令到 Agent 执行,因此此功能非常灵活,使用此功能可以定期结合 restic、rclone 给服务器备份,定期重启某项服务来重置网络连接。也可以配合报警通知,在触发报警时执行某项任务,如 CPU 在长时期处于高占用的情况下运行某个脚本。</p><h2 id="使用方法" tabindex="-1">使用方法 <a class="header-anchor" href="#使用方法" aria-label="Permalink to &quot;使用方法&quot;"></a></h2><p>进入管理面板的 “任务” 页,点击 “添加计划任务”<br> 添加计划任务你需要填入以下参数:</p><ul><li><p><code>名称</code> - 自定义一个任务名称</p></li><li><p><code>任务类型</code> - 选择任务的类型<br> 计划任务 - 按下方设置的计划时间,周期性执行任务<br> 触发任务 - 仅被 API 或报警规则触发的任务,每次触发执行一次</p></li><li><p><code>计划</code> - (使用触发任务类型时不生效)设置计划时间,时间的格式为: <code>* * * * * *</code> 分别对应 <code>秒 分 时 天 月 星期</code>,详情见<a href="https://pkg.go.dev/github.com/robfig/cron/v3#hdr-CRON_Expression_Format" target="_blank" rel="noreferrer">计划表达式格式</a><br> 如:<code>0 0 3 * * *</code> 对应为 <code>每天3点</code></p></li><li><p><code>命令</code> - 你可以在这里设置需要执行的命令,就像写 Shell/Bat 脚本一样,<strong>但是不推荐换行,多个命令使用 <code>&amp;&amp;/&amp;</code> 连接</strong><br> 例如执行定期重启命令,可以在这里输入 <code>reboot</code></p></li><li><p><code>覆盖范围</code> 和 <code>特定服务器</code> - 跟“服务”页中的设置类似,选择规则来确定哪些 Agent 执行计划任务<br> 使用触发任务类型时,可选择<code>由触发的服务器执行</code></p></li><li><p><code>通知方式组</code> - 选择你已经在 “报警” 页设置好的通知方式,<a href="/guide/notifications.html#灵活的通知方式">点击这里</a>了解详情</p></li><li><p><code>推送成功的消息</code> - 勾选此项,任务执行成功后会触发消息通知<br><br></p></li></ul><h2 id="管理任务" tabindex="-1">管理任务 <a class="header-anchor" href="#管理任务" aria-label="Permalink to &quot;管理任务&quot;"></a></h2><p>如需对已有的计划任务进行管理,可以前往管理面板中的 “任务” 页<br> 选择一条任务配置,右侧的三个图标,分别是:</p><ul><li><code>立即执行</code> - 点击后将忽略计划时间,立刻执行任务</li><li><code>编辑</code> - 点击可以修改任务配置</li><li><code>删除</code> - 删除这条计划任务<br><br></li></ul><h2 id="常见问题" tabindex="-1">常见问题 <a class="header-anchor" href="#常见问题" aria-label="Permalink to &quot;常见问题&quot;"></a></h2><ol><li>xxx 命令找不到<br> 如果运行失败,提示 xxx 命令找不到,可能是 PATH 环境变量的问题Linux 服务器在命令开头加入 <code>source ~/.bashrc</code> 或者使用绝对路径执行</li></ol>',10),r=[t];function i(l,s,n,p,_,h){return o(),a("div",null,r)}const m=e(d,[["render",i]]);export{u as __pageData,m as default};