Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

About redshift:

Redshift adjusts the color temperature of your screen according to your surroundings. This may help your eyes hurt less if you are working in front of the screen at night.

A typical redshift command is redshift -O 9999 which sets the screen color temperature at 9999K. Following a polyphasic sleep schedule, i want to change my screen color a few times a day.

So here's part of my crontab:

LOW='redshift -O 1000'
HIGH='redshift -O 9999'

30 4 * * * $LOW
45 12 * * * $LOW
45 20 * * * $LOW
0 6,15,23 * * * $HIGH

It doesn't do anything. I checked the syslog, it does run, but when i catch the output in a file, the file is empty.

Why does this not work? Are there any alternatives to Redshift i can try?

share|improve this question
2  
Commands ran from cron don't have the shell environment variables such as DISPLAY set. Consider what happens when you replace your command in cron with env. You need to set the DISPLAY variable. –  Dan D. Jul 17 '13 at 0:14
add comment

1 Answer 1

up vote 2 down vote accepted

Thanks Dan D. This worked:

LOW='redshift -O 1000'
HIGH='redshift -O 9999'
DISPLAY=:0.0

30 4 * * * $LOW
45 12 * * * $LOW
45 20 * * * $LOW
0 6,15,23 * * * $HIGH
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.