setup‐periodic - uhop/dotfiles GitHub Wiki

setup-periodic

Set up periodic scheduled tasks using systemd timers (Linux) or launchd system daemons (macOS). Creates the scheduler config, enables the timer, and checks for msmtp as a prerequisite — see Msmtp for install and configuration.

Usage

setup-periodic add daily "4:00" "playbash run @self daily --report"
setup-periodic add weekly "4:00 su" "playbash run @self weekly --report"
setup-periodic list
setup-periodic remove daily

Schedule format

Schedule is specified as <when> [<days>]:

Component Syntax Examples
when (time of day) HH:MM 4:00, 23:30
when (interval) Nh (hours), Nm (minutes) 4h, 15m
days (range) mo-fr mo-fr, sa-su, sa-mo (wrap-around)
days (list) mo,we,fr tu,th, mo,we,fr
days (day of month) 1,15 1, 1,15

Day names: mo tu we th fr sa su (3-char aliases like mon, tue also accepted).

Examples

setup-periodic add maint "4:00 mo-sa" "playbash run @self daily --report"
setup-periodic add weekly "4:00 su" "playbash run @self weekly --report"
setup-periodic add backup 4h "/path/to/backup"
setup-periodic add health 15m "health-check"
setup-periodic add report "6:00 1,15" "generate-report"

Commands

Command Description
add (alias a) Create a periodic task
list (alias ls) List active periodic tasks
remove (alias rm) Remove a periodic task

Options

Option Description
--email ADDRESS Notification email address (with add)
-v, --version Show version
-h, --help Show help

Notification wrappers

Three wrappers for different contexts. All email via sendmail (msmtp) and are silent on clean success.

Wrapper Used by What it does
notify-playbash setup-periodic (playbash tasks) Runs playbash --report, emails if exit non-zero or report non-empty
notify-on-failure setup-periodic (generic tasks on macOS/cron) Runs a command, emails captured output on non-zero exit
notify-systemd-failure [email protected] (Linux) Reads journalctl for the failed unit, emails via sendmail

See Workflows: maintenance — Scheduled maintenance for full setup instructions.

⚠️ **GitHub.com Fallback** ⚠️