Skip to content

Instantly share code, notes, and snippets.

@xarinatan
Last active March 10, 2018 08:09
Show Gist options
  • Save xarinatan/9fc93b84e2c7fd371fc8be83d4df488b to your computer and use it in GitHub Desktop.
Save xarinatan/9fc93b84e2c7fd371fc8be83d4df488b to your computer and use it in GitHub Desktop.
Bash script to manage Redshift with 5 different zones
#/bin/bash
#This bash file will run in a loop until killed, and edit the color temperature throughout the day based on the times below.
while true; do
curTime=$(date +"%k")
if (( $curTime >= 9 && $curTime < 18 )); then #between 9am and 6pm
redshift -x #Reset all settings
elif (( $curTime >= 18 && $curTime < 21 )); then
redshift -O 4200k #Set color temp of 4200k
elif (( $curTime >= 21 && $curTime < 23 )); then
redshift -O 2300k #etc
elif (( $curTime >= 23 || $curTime >= 0 && $curTime < 6 )); then
redshift -O 1000k
elif (( $curTime >= 6 && $curTime < 9 )); then
redshift -O 2000k
fi
sleep 30
done
@xarinatan
Copy link
Author

no transitions though, since oneshot mode doesn't seem to support that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment