@Sam-0 said in cron job hdmi on and off:
i created two files
off.sh and on.sh
they contain the following lineswlr-randr --output HDMI-A-1 --off
wlr-randr --output HDMI-A-1 --on
Do you have #!/bin/bash or #!/bin/sh at the very beginning of your shell scripts ?
#! /bin/sh – Execute the file using the Bourne shell, or a compatible shell, assumed to be in the /bin directory
#! /bin/bash – Execute the file using the Bash shell
You can also put /bin/bash in the crontab entry (before /home/username/...).
Then there is no way for cron to not execute it as a shell script and it will even run without the executable bit set.
And what Sam mentioned: the scripts need to be executable but not necessarily writable (chmod 755).
This should normally do the trick.
If you have mail installed (which mail) you can put this at the very beginning of the crontab file:
MAILTO=username (in my case admin).
With
journalctl --since "1 day ago" --unit cron.service --no-pager
you can see if cron ran your script and with mail you can see more details on the cron job executed.
Good luck.