Read the statement by Michael Teeuw here.
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 --oni also created a folder
with the following rights:
cmod 777
the cron contains the following lines:
unfortunately this does not work what is wrong?# Schakel display uit zondag - donderdag om 22.00 00 22 * * 0-4 /home/username/MagicMirror/config/hdmionoff/off.sh>> /home/username/MagicMirror/config/hdmionoff/mof.log 2>&1 # Schakel display uit vrijdag - zaterdag om 22.45 45 22 * * 5,6 /home/username/MagicMirror/config/hdmionoff/off.sh>> /home/username/MagicMirror/config/hdmionoff/mof.log 2>&1 # Zet het scherm aan maandag - vrijdag om 7u00 00 07 * * 1-5/home/username/MagicMirror/config/hdmionoff/on.sh>> /home/username/MagicMirror/config/hdmionoff/mon.log 2>&1 # Zet het scherm aan zaterdag - zondag om 8u00 00 08 * * 6,0/home/username/MagicMirror/config/hdmionoff/on.sh>> /home/username/MagicMirror/config/hdmionoff/mon.log 2>&1
-
@Sam-0 are the sh files marked executable?
ls -laF in your folder to see
permissions are 3 groups of 3 settings
read/write/execute
for user, group and all others
9 settings from the right
one more for directory and 1 for systemds, user, group, other
-
-
@Sam-0 yes. although you dont need write permission, (except for user)
means anyone else could change the script -
@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 --onDo 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 shellYou 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 caseadmin
).
With
journalctl --since "1 day ago" --unit cron.service --no-pager
you can see if cron ran your script and withmail
you can see more details on the cron job executed.Good luck.
-
@evroom Thanks for your explanation, I have made adjustments and will check tonight if it works. I will report this back. Thanks for the effort.
-
-
So it seems that the cronjob is okay.
Can you do:
ˋˋˋls -als /run/user/1000/wayland*ˋˋˋI think you need wayland-0 iso wayland-1.
With ˋˋˋ grep username /etc/passwdˋˋˋ (use your username) you can verify that your user has uid 1000.
-
In de laatste 2 regels mist een spatie bij /home.
-
This post is deleted!