2 lines
4.0 KiB
JavaScript
2 lines
4.0 KiB
JavaScript
import{_ as e,o as t,c as o,R as a}from"./chunks/framework.44fd0451.js";const g=JSON.parse('{"title":"","description":"","frontmatter":{},"headers":[],"relativePath":"en_US/guide/tasks.md","filePath":"en_US/guide/tasks.md","lastUpdated":1698335020000}'),i={name:"en_US/guide/tasks.md"},s=a('<p><strong>In the task area, you can set up scheduled tasks, Trigger tasks, and multi-server batch execution tasks</strong></p><p>Nezha monitoring supports pushing commands to the Agent for execution, so this feature is very flexible and can be used to periodically back up the server in conjunction with restic, rclone. Periodically restart a service to reset the network connection. It can also be used with notifications to perform a task when a notification is triggered, such as running a script when the CPU is at high occupancy for a long period of time.</p><h2 id="how-to-use" tabindex="-1">How to use <a class="header-anchor" href="#how-to-use" aria-label="Permalink to "How to use""></a></h2><p>Go to the "Tasks" page of the admin panel and click "Add Scheduled Task"<br> To add a scheduled task you need to make the following settings:</p><ul><li><p><code>Name</code> - Customize a task name</p></li><li><p><code>Task Type</code> - select the type of task<br> Scheduled Tasks - Tasks are executed periodically at the scheduled time set below<br> Trigger Tasks - Tasks that are triggered only by API or notification rules and are executed once per trigger</p></li><li><p><code>Cron Expression</code> - (Not valid when using the trigger task type) Set schedule time, the Cron Expression is like:: <code>* * * * * *</code> <code>sec min hour day month week</code>, see details in <a href="https://pkg.go.dev/github.com/robfig/cron/v3#hdr-CRON_Expression_Format" target="_blank" rel="noreferrer">CRON Expression Format</a><br> For example: <code>0 0 3 * * *</code> is <code>Every day at 3 o'clock</code></p></li><li><p><code>Command</code> - Just like writing shell/bat scripts, <strong>but line wrap is not recommended</strong>, <strong>Multiple Commands should be connected with <code>&&/&</code></strong><br> For example, to execute a periodic reboot command, you can type <code>reboot</code> here</p></li><li><p><code>Coverage</code> and <code>Specific Servers</code> - Similar to the settings on the Services page, select rules to determine which Agents need to execute scheduled tasks<br> When using the trigger task type, you can select <code>Only servers that are included in the notification rule</code></p></li><li><p><code>Notification Group</code> - Select the notification method you have set up on the "Notification" page. <a href="/en_US/guide/notifications.html#flexible-notification-methods">Click here</a> for more information</p></li><li><p><code>Send Success Notification</code> - When this item is activated, a message notification will be triggered when the task is successfully executed<br><br></p></li></ul><h2 id="manage-tasks" tabindex="-1">Manage tasks <a class="header-anchor" href="#manage-tasks" aria-label="Permalink to "Manage tasks""></a></h2><p>To manage existing scheduled tasks, you can go to the "Tasks" page in the administration panel<br> Select a task configuration and the three icons on the right, which are:</p><ul><li><code>Execute Now</code> - When clicked, the scheduled time will be ignored and the task will be executed immediately</li><li><code>Edit</code> - Click to modify the task configuration</li><li><code>Delete</code> - Delete this scheduled task<br><br></li></ul><h2 id="faq" tabindex="-1">FAQ <a class="header-anchor" href="#faq" aria-label="Permalink to "FAQ""></a></h2><ol><li>Command not found<br> Command not found may cause by missing PATH environment variable, for Linux Server, you may try adding <code>source ~/.bashrc</code> at beginning of your command or execute by absolute path.</li></ol>',10),n=[s];function r(c,d,l,h,u,p){return t(),o("div",null,n)}const k=e(i,[["render",r]]);export{g as __pageData,k as default};
|