https://github.com/kconner/scheduled-tasks
CLI for scheduling periodic scripts with launchd
https://github.com/kconner/scheduled-tasks
Last synced: 10 months ago
JSON representation
CLI for scheduling periodic scripts with launchd
- Host: GitHub
- URL: https://github.com/kconner/scheduled-tasks
- Owner: kconner
- Created: 2025-08-02T23:34:36.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-08-03T03:23:21.000Z (11 months ago)
- Last Synced: 2025-08-03T05:23:48.631Z (11 months ago)
- Language: Shell
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Scheduled Tasks
A light system for scheduling macOS terminal commands as repeating launchd agents.
- A task can run daily, hourly, or every N minutes.
- Task runs are logged.
- If one or more runs of a task are missed during sleep, the task runs once when the system wakes.
## Usage
Clone this repository to any location. Avoid changing that location while any tasks exist.
```sh
# list tasks
./scheduled-tasks
# add a task
./scheduled-tasks add
# intervals: daily, hourly, or
# remove a task
./scheduled-tasks remove
# get a task's log file path
./scheduled-tasks log
# tail a task's log
tail -f $(./scheduled-tasks log )
```
## How it works
For each created task, a plist in `~/Library/LaunchAgents/` passes the given command to `run-task.sh`. Really it's done through a symlink in the `tasks/` folder, which exists to give a distinct, recognizable name to each task in System Settings and elsewhere.
It's default launchctl behavior to dedupe task runs missed during sleep.
`run-task.sh` executes the command and appends to the task's logfile in the `logs/` folder.