Created
August 7, 2019 22:43
-
-
Save ccfiel/fbe00743fe4f3a049ac43cfcc3247f6c to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/bash | |
WORKDIR=/home/chris/ | |
LOGFILE=/tmp/backlight.log | |
KBDBACKLIGHT=`cat /sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/brightness` | |
HOUR=`date +%H` | |
echo "---------------->" | tee -a $LOGFILE | |
date | tee -a $LOGFILE | |
if [ $HOUR -lt 6 -o $HOUR -gt 19 ]; then | |
echo "HOUR $HOUR must turn on backlight" | tee -a $LOGFILE | |
BACKLIGHT=3 | |
else | |
echo "HOUR $HOUR must turn off the backlight" | tee -a $LOGFILE | |
BACKLIGHT=0 | |
fi | |
if [ $KBDBACKLIGHT -ne $BACKLIGHT ]; then | |
echo "Current backlight $KBDBACKLIGHT is different from desired backlight $BACKLIGHT" | tee -a $LOGFILE | |
echo $BACKLIGHT > /sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/brightness | |
else | |
echo "Current backlight $KBDBACKLIGHT is the same from desired backlight $BACKLIGHT" | tee -a $LOGFILE | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment