Created
August 29, 2025 14:14
-
-
Save jordienr/52d37f9af287cfce2adf22bbcb910f74 to your computer and use it in GitHub Desktop.
cron CLI tool
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cron() { | |
| interval=$1 | |
| shift | |
| unit=$1 | |
| shift | |
| case "$unit" in | |
| second|seconds) sleep_time=$interval ;; | |
| minute|minutes) sleep_time=$((interval * 60)) ;; | |
| *) echo "Unsupported unit: $unit"; return 1 ;; | |
| esac | |
| while true; do | |
| "$@" | |
| sleep "$sleep_time" | |
| done | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment