Change screen brightness by hour
Official kiosk documentation can be find here: http://porteus-kiosk.org/documentation.html
Porteus Kiosk section of the forum is unmaintained now. Its kept in a 'read only' mode for archival purposes.
Please use the kiosk contact page for directing your queries: https://porteus-kiosk.org/contact.html
Change screen brightness by hour
Post#1 by jet » 05 Sep 2018, 17:09
For as an example one would like the screen have 100 brightness 10:00 and dim it after 20:00 to 75%
Kind regards,
Jan
jet
-
- Black ninja
- Posts: 75
- Joined: 28 Oct 2017, 13:40
- Distribution: 4.0 XFCE, Manjaro
- Location: .bay.de
Change screen brightness by hour
Post#2 by apollo » 05 Sep 2018, 17:31
Code: Select all
/sys/class/backlight/<your_device>/brightness
apollo
Change screen brightness by hour
Post#3 by jet » 05 Sep 2018, 20:32
Yes please, send example.
How to obtain the device screen name? Is there a common alias (for the primary screen) that could be used directly?
Kind regads,
Jan
jet
- fanthom
- Moderator Team
- Posts: 5667
- Joined: 28 Dec 2010, 02:42
- Distribution: Porteus Kiosk
- Location: Poland
- Contact:
Change screen brightness by hour
Post#4 by fanthom » 06 Sep 2018, 18:23
http://porteus-kiosk.org/faq.html#22
fanthom
-
- Black ninja
- Posts: 75
- Joined: 28 Oct 2017, 13:40
- Distribution: 4.0 XFCE, Manjaro
- Location: .bay.de
Change screen brightness by hour
Post#5 by apollo » 07 Sep 2018, 13:18
Code: Select all
#!/bin/bash
HOUR=`date +%H`
# replace the values with the hours you want to change the brightness
# for easier comparing we use the 24-hours-scheme
if (( $HOUR < 8 )) || (( $HOUR > 13 )); then
# replace with the required brightness value
BRIGHT=50
else
# replace with the required brightness value
BRIGHT=100
fi
# replace "radeon_bl0" with the corresponding dir on your system
echo $BRIGHT | tee /sys/class/backlight/radeon_bl0/brightness
Instead of directly tee-ing to a specified file, you could enumerate through the directories in /sys/class/backlight/ and set it for all displays. If i have time later i will add this to the script.
apollo
Change screen brightness by hour
Post#6 by jet » 09 Sep 2018, 15:13
Yes, would be very nice to have the script to enumerate through the directories in /sys/class/backlight/
Kind regards,
Jan
jet
Change screen brightness by hour
Post#7 by jet » 12 Sep 2018, 12:10
Hi.fanthom wrote: ↑06 Sep 2018, 18:23Once you figure out the script part you may program cron as described here:
http://porteus-kiosk.org/faq.html#22
Is there any other way to inject the script to cron?
Can it be loaded and included to Porteus Kiosk thru run_command and wget?
Kind regards,
Jan
jet
- fanthom
- Moderator Team
- Posts: 5667
- Joined: 28 Dec 2010, 02:42
- Distribution: Porteus Kiosk
- Location: Poland
- Contact:
Change screen brightness by hour
Post#8 by fanthom » 12 Sep 2018, 13:18
I believe you could download and replace whole /etc/crontab file with 'run_command='.
Let us know if this method works so i'll update the FAQ.
fanthom
Change screen brightness by hour
Post#9 by jet » 12 Sep 2018, 15:22
Thanks

I assume I have to put something like this to run_command=
Code: Select all
wget https://domain.com/files/script.sh -O /home/script.sh; chown -R 1000:1000 /home/script.sh; chmod +X /home/script.sh; echo '* * * * * root su - -c "/home/script.sh" ' >> /etc/crontab;
Jan
jet
jet
- fanthom
- Moderator Team
- Posts: 5667
- Joined: 28 Dec 2010, 02:42
- Distribution: Porteus Kiosk
- Location: Poland
- Contact:
Change screen brightness by hour
Post#11 by fanthom » 13 Sep 2018, 07:09
Anyway - this is enough to run the script:
Code: Select all
wget https://domain.com/files/script.sh -O /home/script.sh; echo '* * * * * root su - -c "sh /home/script.sh"' >> /etc/crontab;
Also - its better to download files to /opt as /home may be refreshed (depends on your persistence level).
fanthom
Change screen brightness by hour
Post#12 by jet » 18 Sep 2018, 12:19
The executing seems to work, but I think permissions (and owner?) should be changed for /sys/class/backlight/ to be able to read and modify the brightness file?
jet
- fanthom
- Moderator Team
- Posts: 5667
- Joined: 28 Dec 2010, 02:42
- Distribution: Porteus Kiosk
- Location: Poland
- Contact:
Change screen brightness by hour
Post#13 by fanthom » 18 Sep 2018, 14:21
Code: Select all
* * * * * root
You may add following line to your script to confirm this:
Code: Select all
whoami >> /opt/script.log
fanthom
Change screen brightness by hour
Post#14 by jet » 19 Sep 2018, 13:18
Found out that there was a missing $-sign in my script and there were some other issues too..
Now finally got it up and running!
Kind regards,
Jan
jet