Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3831

Troubleshooting • Turn Display On and Off with Crontab at Raspberry 5

$
0
0
Hello,

since a week I'm trying to get a crontab turn off and on my monitor.

Simply this gives me:

Code:

wlr-randr --output HDMI-A-1 --off

Code:

failed to connect to display
This works via ssh:

Code:

WAYLAND_DISPLAY="wayland-1" wlr-randr --output HDMI-A-1 --off
So, I opened crontab with

Code:

crontab -e
First i tried:

Code:

0 23 * * * WAYLAND_DISPLAY="wayland-1" wlr-randr --output HDMI-A-1 --off  >>./Log.txt 2>&1
I get:

Code:

failed to connect to display
I'm trying the script from here:

Code:

#!/bin/bashexport WAYLAND_DISPLAY=wayland-1export XDG_RUNTIME_DIR=/run/user/1000/usr/bin/wlr-randr --output HDMI-A-1 --off
Saved it as monitorOff.sh and running:

Code:

bash monitorOff.sh
Getting:

Code:

failed to connect to display
Tried the following script:

Code:

#!/bin/bashexport WAYLAND_DISPLAY=wayland-1export XDG_RUNTIME_DIR=/run/user/1000WAYLAND_DISPLAY="wayland-1" /usr/bin/wlr-randr --output HDMI-A-1 --off
Getting the same error. Same with calling the script in crontab.

Does anybody knows a solution?

Thanks!

Statistics: Posted by Bezebub — Fri Sep 27, 2024 7:58 pm



Viewing all articles
Browse latest Browse all 3831

Trending Articles