Files
sencho/docs/features/scheduled-operations.mdx
T
Anso c328b7f49a refactor: rename Personal Pro to Skipper and Team Pro to Admiral (#256)
Align paid tier names with Sencho's nautical identity. Internal variant
values ('personal'/'team') remain unchanged in code, database, and
Lemon Squeezy integration — only user-facing display names updated.

- Backend: requireTeamPro → requireAdmiral, TEAM_PRO_REQUIRED → ADMIRAL_REQUIRED
- Frontend: TeamProGate.tsx → AdmiralGate.tsx, TierBadge labels updated
- Website: PricingSection tier names and nautical descriptions
- Docs: all 11 affected pages renamed, nautical footnote added to licensing
2026-03-29 18:00:29 -04:00

101 lines
4.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
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.
---
title: Scheduled Operations
description: Automate recurring Docker operations like stack restarts, fleet snapshots, and system prunes on a cron schedule.
---
<Note>
Scheduled Operations requires a Sencho **Admiral** license.
Skipper and Community Edition do not include this feature.
</Note>
## Overview
Scheduled Operations lets you automate recurring maintenance tasks across your infrastructure. Define a cron schedule, choose an action, and Sencho handles the rest - including a full execution history log so you always know what ran and when.
<Frame>
<img src="/images/scheduled-operations/overview.png" alt="Scheduled operations list view showing tasks with status, schedule, and actions" />
</Frame>
## Supported Actions
| Action | Target | Description |
|--------|--------|-------------|
| **Restart Stack** | A specific stack on a specific node | Restarts all containers in the stack via the Docker Engine API |
| **Fleet Snapshot** | All nodes | Creates a fleet-wide backup of all compose files and `.env` files |
| **System Prune** | A specific node (or the default node) | Prunes selected resources (containers, images, networks, volumes — all by default) |
## Creating a Scheduled Task
1. Navigate to the **Schedules** tab in the top navigation bar (visible to Admiral admins).
2. Click **New Schedule**.
3. Fill in the form:
- **Name** - a descriptive label (e.g. "Nightly staging restart").
- **Action** - choose Restart Stack, Fleet Snapshot, or System Prune.
- **Stack / Node** - if you chose Restart Stack, select the target stack and the node it runs on.
- **Prune Targets** - if you chose System Prune, select which resources to prune (containers, images, networks, volumes). All are selected by default.
- **Cron Expression** - standard 5-field cron format. A human-readable preview appears below the input.
- **Enabled** - toggle the task on or off.
4. Click **Create**.
<Frame>
<img src="/images/scheduled-operations/create-dialog.png" alt="Create scheduled task dialog with action, cron expression, and prune target options" />
</Frame>
## Cron Expression Reference
Sencho uses standard 5-field cron expressions:
```
┌───────────── minute (059)
│ ┌─────────── hour (0–23)
│ │ ┌───────── day of month (131)
│ │ │ ┌─────── month (112)
│ │ │ │ ┌───── day of week (07, 0 and 7 = Sunday)
│ │ │ │ │
* * * * *
```
### Common Examples
| Expression | Description |
|-----------|-------------|
| `0 3 * * *` | Every day at 3:00 AM |
| `0 */6 * * *` | Every 6 hours |
| `0 3 * * 0` | Every Sunday at 3:00 AM |
| `30 2 1 * *` | 1st of every month at 2:30 AM |
| `0 0 * * 1-5` | Midnight on weekdays |
## Managing Tasks
- **Enable/Disable** - Use the toggle switch in the task list to pause or resume a schedule without deleting it.
- **Run Now** - Click the play icon to immediately execute a task. This works even on disabled tasks, allowing you to test a schedule before enabling it. Manual runs are labeled "Manual" in the execution history.
- **Edit** - Click the pencil icon to update the task name, schedule, or target.
- **Delete** - Click the trash icon to permanently remove the task and all its execution history.
## Execution History
Click the history icon on any task to view its execution log. Each entry shows:
- **Timestamp** - when the task ran.
- **Source** - whether the run was triggered by the scheduler or manually via Run Now.
- **Status** - success or failure.
- **Duration** - how long the execution took.
- **Details** - output message or error description.
Execution history is retained for 30 days.
<Frame>
<img src="/images/scheduled-operations/run-history.png" alt="Execution history showing run source, status, duration, and details with pagination" />
</Frame>
## How It Works
The Scheduler Service runs in the background and checks for due tasks every 60 seconds. When a task's next run time has passed:
1. The scheduler verifies your Admiral license is active.
2. It executes the configured action using the same internal services that power the UI buttons (restart, snapshot, prune).
3. Results are logged to the execution history.
4. The next run time is recalculated from the cron expression.
If a task is still running from a previous execution, the scheduler skips it to prevent overlap.