Shut off display after 10 minute service issue

Raspberry Pi related support

Shut off display after 10 minute service issue

Postby fullbugg » 08 Sep 2020, 19:50

Hello,
I am new to RuneAudio and it is great. I am trying to get my display to shut off after 10 minutes of inactivity.

Current System:
RuneAudio 0.5
RPi 3b+
HiFiBerry DAC+
Official RPi 7" Touchscreen

I have a script in /usr/bin/kill_display.sh and have tested it by just executing it.

Code: Select all
xset -dpms -display :0
xset dpms 0 0 600 -display :0



I then, as best as I can tell granted permissions
Code: Select all
chmod +x /usr/bin/kill_display.sh


I have also created a service file and placed it in /usr/lib/systemd/system/kill_display.service

Code: Select all
[Unit]
Description=Startup kill_display
After=systemd-modules-load.service

[Service]
Type=forking
ExecStart=/usr/bin/bash /usr/bin/kill_display.sh

[Install]
WantedBy=multi-user.target


After this I have tried to start (with no error) the service but after 10 minutes the display does not shut off
Code: Select all
systemctl start kill_display


I went ahead and enabled the service just in the off chance
Code: Select all
systemctl enable kill_display


After a reboot the service doesn't appear to start. But as mentioned... I can execute the script from bash and it works perfectly.

Please tell me what I am missing.
fullbugg
 
Posts: 2
Joined: 08 Sep 2020, 19:30

Re: Shut off display after 10 minute service issue

Postby fullbugg » 09 Sep 2020, 01:47

Figured it out... there may be extraneous commands in the kill_display.sh and kill_display.service but it works and I hope that it helps others wanting this functionality.

kill_display.sh
Code: Select all
#!/bin/sh
Environment=DISPLAY=:0
xset -display ":0.0" -dpms &
xset -display ":0.0" dpms 0 0 600  &


kill_display.service
Code: Select all
[Unit]
Description=Startup kill_display
After=mpd.service

[Service]
Type=forking
ExecStart=/usr/bin/bash /usr/bin/kill_display.sh
TimeoutSec=0
Restart=always
RestartSec=1
StartLimitInterval=30
StartLimitBurst=20

[Install]
WantedBy=multi-user.target
fullbugg
 
Posts: 2
Joined: 08 Sep 2020, 19:30

support RuneAudio Donate with PayPal


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 12 guests
cron