wakethemup

module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: MIT

README

wakethemup

unknown

Install

From source:

go install github.com/smm-h/wakethemup/cmd/wake@latest

Or download a binary from GitHub Releases.

Quick start

Create a TOML config file (e.g. backup.toml):

version = 1

[schedule]
name = "backup"
description = "Daily database backup"
calendar = "*-*-* 03:00:00"

[command]
exec = "/usr/local/bin/backup.sh"
working_directory = "/var/backups"

Then use the CLI:

wake install backup.toml   # create and start the systemd timer
wake list                   # show all installed schedules
wake status backup          # show timer/service status and recent logs
wake remove backup          # stop and delete the schedule

TOML schema

The config file version is currently 1. Unknown keys are rejected.

Top-level
Key Type Required Description
version int yes Schema version, must be 1
[schedule]
Key Type Required Description
name string yes Schedule identifier (alphanumeric, hyphens, underscores; max 64 chars). Used as the systemd unit name (wake-<name>.timer).
description string yes Human-readable description, used in the unit's Description= field
calendar string yes systemd calendar expression (validated via systemd-analyze calendar). Examples: daily, *-*-* 03:00:00, Mon *-*-* 09:00:00.
[command]
Key Type Required Description
exec string yes Command to run. Binary names are resolved to absolute paths via $PATH.
working_directory string no Working directory for the command. Must exist at install time.
env_file string no Path to an environment file loaded by systemd (EnvironmentFile=). Must exist at install time.
[env]

Optional section. Each key is an environment variable name (must match ^[A-Za-z_][A-Za-z0-9_]*$), and each value must be a string. Variables are set via systemd Environment= directives.

[env]
DATABASE_URL = "postgres://localhost/mydb"
LOG_LEVEL = "info"

Commands

Command Description
check Run project checks
install Install a schedule from a TOML config file
list List installed schedules
remove Remove an installed schedule
status Show status of a schedule

Behavior

  • Persistent timers. All timers are created with Persistent=true. If the machine was off when a timer should have fired, systemd runs one catch-up execution on boot.
  • Shell detection. Commands containing shell metacharacters (|, &&, ||, ;, >, <, `, $(, &) are automatically wrapped in /bin/sh -c "...". Commands without metacharacters are resolved to absolute binary paths and executed directly.
  • Linger. On first install, loginctl enable-linger is run automatically so that user timers fire without an active login session.
  • Atomic writes. Unit files are written to a temp file and renamed into place, preventing partial writes.
  • Ownership verification. wake remove checks for the X-WakeConfig= marker in the service unit and refuses to remove units not created by wake.

Packages

  • cmd/wake/integration_test (cmd/wake/integration_test.go)
  • cmd/wake/main (cmd/wake/main.go)
  • internal/config/config (internal/config/config.go)
  • internal/config/config_test (internal/config/config_test.go)
  • internal/systemd/checks_test (internal/systemd/checks_test.go)
  • internal/systemd/exec (internal/systemd/exec.go)
  • internal/systemd/linger (internal/systemd/linger.go)
  • internal/systemd/linger_test (internal/systemd/linger_test.go)
  • internal/systemd/mock_test (internal/systemd/mock_test.go)
  • internal/systemd/systemd (internal/systemd/systemd.go)
  • internal/systemd/systemd_test (internal/systemd/systemd_test.go)
  • internal/systemd/types (internal/systemd/types.go)
  • internal/unit/escape (internal/unit/escape.go)
  • internal/unit/unit (internal/unit/unit.go)
  • internal/unit/unit_test (internal/unit/unit_test.go)

Directories

Path Synopsis
cmd
wake command
internal
config
Package config handles TOML schedule configuration parsing and validation.
Package config handles TOML schedule configuration parsing and validation.
systemd
Package systemd manages systemd user-level timer and service units.
Package systemd manages systemd user-level timer and service units.
unit
Package unit generates systemd unit file content from schedule configs.
Package unit generates systemd unit file content from schedule configs.

Jump to

Keyboard shortcuts

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