Skip to main content
added 143 characters in body
Source Link
erik404
  • 126
  • 2

You're not testing against the value in $currentime but against a str with the value $currentime. You need to remove the quotes around "$currenttime"

Like so:

if [[ $currenttime > "17:00" ]]; then

But it may be waaaay simpler to run the commands in a cronjob. I dont know how you start this script, but if you do it with cronjob and execute every minute then every minute the light program receives a command to adjust the value. I would make more sense to execute the command only on the exact set time you would want to

0 18 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 25 >/dev/null 2>&1

0 19 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 50 >/dev/null 2>&1

0 20 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 100 >/dev/null 2>&1

0 6 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 50 >/dev/null 2>&1

0 7 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 0 >/dev/null 2>&1

edit:

or run the script every minute and increase the light value by (max_light_val / minutes_till_next_setting). That can be fun :)

You're not testing against the value in $currentime but against a str with the value $currentime. You need to remove the quotes around "$currenttime"

Like so:

if [[ $currenttime > "17:00" ]]; then

But it may be waaaay simpler to run the commands in a cronjob. I dont know how you start this script, but if you do it with cronjob and execute every minute then every minute the light program receives a command to adjust the value. I would make more sense to execute the command only on the exact set time you would want to

0 18 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 25 >/dev/null 2>&1

0 19 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 50 >/dev/null 2>&1

0 20 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 100 >/dev/null 2>&1

0 6 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 50 >/dev/null 2>&1

0 7 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 0 >/dev/null 2>&1

You're not testing against the value in $currentime but against a str with the value $currentime. You need to remove the quotes around "$currenttime"

Like so:

if [[ $currenttime > "17:00" ]]; then

But it may be waaaay simpler to run the commands in a cronjob. I dont know how you start this script, but if you do it with cronjob and execute every minute then every minute the light program receives a command to adjust the value. I would make more sense to execute the command only on the exact set time you would want to

0 18 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 25 >/dev/null 2>&1

0 19 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 50 >/dev/null 2>&1

0 20 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 100 >/dev/null 2>&1

0 6 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 50 >/dev/null 2>&1

0 7 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 0 >/dev/null 2>&1

edit:

or run the script every minute and increase the light value by (max_light_val / minutes_till_next_setting). That can be fun :)

added 462 characters in body
Source Link
erik404
  • 126
  • 2

How is this script executed? ItYou're not testing against the value in $currentime but against a str with the value $currentime. You need to remove the quotes around "$currenttime"

Like so:

if [[ $currenttime > "17:00" ]]; then

But it may be waaaay simpler to run the commands in a cronjob. I dont know how you start this script, but if you do it with cronjob and execute every minute then every minute the light program receives a command to adjust the value. I would make more sense to execute the command only on the exact set time you would want to

0 18 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 25 >/dev/null 2>&1

0 19 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 50 >/dev/null 2>&1

0 20 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 100 >/dev/null 2>&1

0 6 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 50 >/dev/null 2>&1

0 7 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 0 >/dev/null 2>&1

How is this script executed? It may be simpler to run the commands in a cronjob

0 18 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 25 >/dev/null 2>&1

0 19 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 50 >/dev/null 2>&1

0 20 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 100 >/dev/null 2>&1

0 6 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 50 >/dev/null 2>&1

0 7 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 0 >/dev/null 2>&1

You're not testing against the value in $currentime but against a str with the value $currentime. You need to remove the quotes around "$currenttime"

Like so:

if [[ $currenttime > "17:00" ]]; then

But it may be waaaay simpler to run the commands in a cronjob. I dont know how you start this script, but if you do it with cronjob and execute every minute then every minute the light program receives a command to adjust the value. I would make more sense to execute the command only on the exact set time you would want to

0 18 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 25 >/dev/null 2>&1

0 19 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 50 >/dev/null 2>&1

0 20 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 100 >/dev/null 2>&1

0 6 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 50 >/dev/null 2>&1

0 7 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 0 >/dev/null 2>&1
Source Link
erik404
  • 126
  • 2

How is this script executed? It may be simpler to run the commands in a cronjob

0 18 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 25 >/dev/null 2>&1

0 19 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 50 >/dev/null 2>&1

0 20 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 100 >/dev/null 2>&1

0 6 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 50 >/dev/null 2>&1

0 7 * * * light -Srs "sysfs/leds/chromeos::kbd_backlight" 0 >/dev/null 2>&1