Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/meowgorithm/babycron
Run a single cron job in the foreground. Works well in Docker.
https://github.com/meowgorithm/babycron
cli cron crontab docker
Last synced: about 2 months ago
JSON representation
Run a single cron job in the foreground. Works well in Docker.
- Host: GitHub
- URL: https://github.com/meowgorithm/babycron
- Owner: meowgorithm
- License: mit
- Created: 2020-08-30T15:18:15.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-08-15T20:19:10.000Z (over 2 years ago)
- Last Synced: 2024-10-16T19:19:11.850Z (about 2 months ago)
- Topics: cli, cron, crontab, docker
- Language: Go
- Homepage:
- Size: 27.3 KB
- Stars: 13
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-repositories - meowgorithm/babycron - Run a single cron job in the foreground. Works well in Docker. (Go)
README
Babycron
========[![Build Status](https://github.com/meowgorithm/babycron/workflows/build/badge.svg)](https://github.com/meowgorithm/babycron/actions)
Run a single cron job in the foreground, sending output to stdout. Works well
in Docker.## Usage
Pass two arguments: the cron schedule and a string of the task to run.
```bash
# Run a script every minute
babycron '*/1 * * * *' 'sh path/to/script.sh'# Run a script on start, and then again every six hours
babycron --run-on-start '0 */6 * * *' 'sh path/to/script.sh'# Gzip and backup a Redis DB every day at midnight
babycron '0 0 * * *' 'cat /data/dump.rdb | gzip | pipedream -b backups -p backup.rdb.gz'
```Note that if you’re running a script you *must* include the interpreter in the
second argument (i.e. `sh` or `/bin/sh`), regardless if you have a `#!` and
executable permissions. Babycron will search your `PATH`, so things like `bash`
or `sh`, without the full path to the interpreter, is usually fine.In Docker:
```docker
ENTRYPOINT [ "babycron", "* * * * *", "sh path/to/script.sh" ]
```Output and errors are sent to stdout, so they'll appear in your Docker logs.
## Installation
macOS and Linux users can use Homebrew:
```bash
brew tap meowgorithm && brew install babycron
```Additional binaries can be found on the [releases](https://github.com/meowgorithm/babycron/releases) page (Linux x86_64/ARM, macOS x86_64, Windows x86_64/i386).
Or just use `go get`:
```bash
go get github.com/meowgoritm/babycron
```## License
MIT