Skip to content

Instantly share code, notes, and snippets.

@kaleocheng
Last active August 29, 2015 14:03
Show Gist options
  • Save kaleocheng/1bb6ab33459449bd587f to your computer and use it in GitHub Desktop.
Save kaleocheng/1bb6ab33459449bd587f to your computer and use it in GitHub Desktop.
根据时间改变屏幕的亮度(配合crontab使用)
#!/usr/bin/env bash
#Filename: change_brightness.sh
#这个脚本会根据当前时间来改变系统屏幕的亮度,最好配合crontab来使用,而且我把他放在了/etc/rc.local中开机执行.
current_time=`date +%H`
case $current_time in
0|1|2|3|4|5|6|22|23)
#echo 'Night'
#这一句得用root权限来执行(sudo在这里也不行)
echo 0 > /sys/class/backlight/acpi_video0/brightness
#now=0
;;
18|19|20|21|22)
#echo 'Evening'
echo 3 > /sys/class/backlight/acpi_video0/brightness
#now=3
;;
*)
#echo 'Aftermoon'
echo 7 > /sys/class/backlight/acpi_video0/brightness
#now=7
;;
esac
#echo $now > /home/kaleo/success
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment