schedule

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package schedule manages a siphon-owned block of entries inside the user's crontab. siphon does not run a scheduler daemon itself — it delegates to the host's cron, writing lines that invoke `siphon backup <profile>` on a cron expression. The OS scheduler (already present and battle-tested) runs the jobs; siphon only edits its own managed block.

This file is the pure, I/O-free core: it edits crontab TEXT (add/remove/list siphon entries within delimited markers) so it is fully unit-testable. The CLI layer reads the current crontab, calls these functions, and writes it back.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(crontab, bin string, entry Entry) string

Add returns a new crontab with entry added (or its cron updated if the profile already has an entry). Lines outside the managed block are preserved verbatim.

func Remove

func Remove(crontab, bin, profile string) string

Remove returns a new crontab with the named profile's entry removed. Removing a profile that has no entry is a no-op.

Types

type Entry

type Entry struct {
	Profile string
	Cron    string // standard 5-field cron expression
}

Entry is one scheduled backup: a cron expression and the profile to back up.

func List

func List(crontab string) []Entry

List extracts the siphon-managed entries from a crontab's text. Entries outside the managed block are ignored. Returns them sorted by profile.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL