https://github.com/abiriadev/semicron
Minimal crontab for fast and expressive shell scripting
https://github.com/abiriadev/semicron
cli cron cron-jobs cronjob cronjob-scheduler crontab
Last synced: 7 months ago
JSON representation
Minimal crontab for fast and expressive shell scripting
- Host: GitHub
- URL: https://github.com/abiriadev/semicron
- Owner: abiriadev
- Created: 2023-12-15T07:48:37.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-28T17:31:49.000Z (almost 2 years ago)
- Last Synced: 2025-03-10T13:19:02.360Z (7 months ago)
- Topics: cli, cron, cron-jobs, cronjob, cronjob-scheduler, crontab
- Language: Go
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
semicron
Minimal crontab for fast and expressive shell scripting
## Why not traditional Cron?
Creating and managing a crontab can often be a cumbersome task. It typically involves several challenges:
- **Sudo permission**. In many cases, crontab modifications require elevated permissions, which can be inconvenient or even restrictied in certain environments.
- **Absolute paths**. Crontab demands the use of absolute paths, which makes it more cumbersome when what you want to do is just executing a simple shell script that you just wrote.
- **Lack of second-precision**. The smallest possible unit of traditional cron is minutes, which can be too coarse for more granular or sophisticated automation needs.`semicron` is minimalistc and modern alternative to crontab, perfect for quick and dirty shell scripting.
- **Relative path support**. Unlike crontab, `semicron` allows the use of relative paths. You can run everything in CWD right now!
- **Easy termination**. You can simply terminate `semicron` with a normal `Ctrl + C` command, which is far intuitive, and you no longer have to worry about cron running in the background that you haven't cleared.
- Second-precision: `semicron` supports optional second-precision, enabling more precise and repeatitive work. You don't need to wait almost 10 minutes to confirm cron is working any longer!
- **Cross platform**. Yeah. `semicron` runs perfectly on Windows!## Usage
```sh
Usage:
semicron [OPTIONS] cron cmd arguments...Application Options:
-s, --shell= Shell to execute the commandHelp Options:
-h, --help Show this help message
```## Examples
### Ping
Ping every 15 seconds.
```sh
$ semicron '*/15 * * * * *' ping google.com -- -c 1
```### Today's weather
Show today's weather at 07:00 AM every day.
```sh
$ semicron '0 7 * * *' curl wttr.in
```### Simple timer
```sh
$ semicron '* * * * * *' -s bash figlet '$(date)' -- -w 140_____ _ ____ ____ ___ ___ ____ _ __ _____ _ _ _ ______ _____ ____ ___ ____ _____
| ___| __(_) | _ \ ___ ___ |___ \ / _ \ / _ \___ \ _/ |/ /_ _|___ /| || | | |/ / ___|_ _| |___ \ / _ \___ \|___ /
| |_ | '__| | | | | |/ _ \/ __| __) | (_) | | | | |__) (_) | '_ (_) |_ \| || |_ | ' /\___ \ | | __) | | | |__) | |_ \
| _|| | | | | |_| | __/ (__ / __/ \__, | | |_| / __/ _| | (_) | ___) |__ _| | . \ ___) || | / __/| |_| / __/ ___) |
|_| |_| |_| |____/ \___|\___| |_____| /_/ \___/_____(_)_|\___(_)____/ |_| |_|\_\____/ |_| |_____|\___/_____|____/_____ _ ____ ____ ___ ___ ____ _ __ _________ _ ______ _____ ____ ___ ____ _____
| ___| __(_) | _ \ ___ ___ |___ \ / _ \ / _ \___ \ _/ |/ /_ _|___ / ___| | |/ / ___|_ _| |___ \ / _ \___ \|___ /
| |_ | '__| | | | | |/ _ \/ __| __) | (_) | | | | |__) (_) | '_ (_) |_ \___ \ | ' /\___ \ | | __) | | | |__) | |_ \
| _|| | | | | |_| | __/ (__ / __/ \__, | | |_| / __/ _| | (_) | ___) |__) | | . \ ___) || | / __/| |_| / __/ ___) |
|_| |_| |_| |____/ \___|\___| |_____| /_/ \___/_____(_)_|\___(_)____/____/ |_|\_\____/ |_| |_____|\___/_____|____/_____ _ ____ ____ ___ ___ ____ _ __ _____ __ _ ______ _____ ____ ___ ____ _____
| ___| __(_) | _ \ ___ ___ |___ \ / _ \ / _ \___ \ _/ |/ /_ _|___ / / /_ | |/ / ___|_ _| |___ \ / _ \___ \|___ /
| |_ | '__| | | | | |/ _ \/ __| __) | (_) | | | | |__) (_) | '_ (_) |_ \| '_ \ | ' /\___ \ | | __) | | | |__) | |_ \
| _|| | | | | |_| | __/ (__ / __/ \__, | | |_| / __/ _| | (_) | ___) | (_) | | . \ ___) || | / __/| |_| / __/ ___) |
|_| |_| |_| |____/ \___|\___| |_____| /_/ \___/_____(_)_|\___(_)____/ \___/ |_|\_\____/ |_| |_____|\___/_____|____/
```### GC
Run `git gc` in current working directory every 3 hours.
```sh
$ semicron '0 */3 * * *' git gc
```