diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2026-10-17 10:40:11 -0700 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2026-10-17 10:40:11 -0700 |
| commit | ea127689e0ae2d39b49004be605e541ff80e2621 (patch) | |
| tree | abbe79e5e37792bd8ebea8f9ac788ff5b8aed704 /bin/sct-daemon | |
| download | openbsd-dotfiles-ea127689e0ae2d39b49004be605e541ff80e2621.zip | |
Initial Commit
Diffstat (limited to 'bin/sct-daemon')
| -rwxr-xr-x | bin/sct-daemon | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/bin/sct-daemon b/bin/sct-daemon new file mode 100755 index 0000000..f975081 --- /dev/null +++ b/bin/sct-daemon @@ -0,0 +1,23 @@ +#!/bin/sh +set -o errexit + +main() { + while true; do + hour=$(date +%H) + if is_day "$hour"; then + sct 6500 >/dev/null + elif is_evening "$hour"; then + sct 4500 >/dev/null + elif is_night "$hour"; then + sct 3500 >/dev/null + fi + sleep 600 & + wait $! + done +} + +is_day() { [ "$1" -ge 6 ] && [ "$1" -lt 17 ]; } +is_evening() { [ "$1" -ge 17 ] && [ "$1" -lt 20 ]; } +is_night() { [ "$1" -ge 20 ] && [ "$1" -lt 6 ]; } + +main |