Read the statement by Michael Teeuw here.
Want to turn off my monitor
-
Sure, this is possible. For the beginning it seems easy, because u needn’t any optional hardware :)
For your understanding how cronjobs works u should note the following:
* * * * * user executive_command ┬ ┬ ┬ ┬ ┬ │ │ │ │ │ │ │ │ │ └──── Weekday (0-7, Sunday is 0 or 7) │ │ │ └────── Month (1-12) │ │ └──────── Day (1-31) │ └────────── Hour (0-23) └──────────── Minute (0-59)
So for your special wish ^^it should look like this:
# /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the `crontab' # command to install the new version when you edit this file # and files in /etc/cron.d. These files also have username fields, # that none of the other crontabs do. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command 17 * * * * root cd / && run-parts --report /etc/cron.hourly 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) 47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) 52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly ) 0 6,16 * * 1,2,3,4,5 root /home/pi/monitor_on.sh 0 9,22 * * 1,2,3,4,5 root /home/pi/monitor_off.sh 0 8 * * 6,7 root /home/pi/monitor_on.sh 0 22 * * 6,7 root /home/pi/monitor_off.sh #
Or if you don’t want to create the *.sh files u can also just type the directly command.
Like this:0 6,16 * * 1,2,3,4,5 root /usr/bin/tvservice -p 0 9,22 * * 1,2,3,4,5 root /usr/bin/tvservice -o 0 8 * * 6,7 root /usr/bin/tvservice -p 0 22 * * 6,7 root /usr/bin/tvservice -o
Last thing is the extremely easiest way because u just need to modify the crontab. there is nothing else needed at all.
Just put these commands in your crontab and u are done ^^ -
That’s brill your a legend, got a few hours to myself tomorrow so armed with all this information and sure be giving this a try see what the outcome is.
Thank you so much :) -
@Mykle1 said in Want to turn off my monitor:
{ exec(‘xset dpms force on’, null); }
{ exec(‘xset dpms force off’, null); }These commands do work. I just tested them on my desktop machine with a monitor connected through DVI and a laptop. Displays are immediately turned off (standby) and on. Here’s the laptop.
-
@Mykle1 that’s cool as :) what are you using for the voice command I love that its brill.
-
@robmcc83 said in Want to turn off my monitor:
that’s cool as :) what are you using for the voice command I love that its brill.
-
@cruunnerr i made your tutorial, works like charm! only problem i found is: replaced print “.”, with: print (“.”), Thenks!
-
@Jonae
i encounterd another problem, sometimes after display goes ON the resolution is changed. any ideas why? -
-
@karsten13 said in Want to turn off my monitor:
I had similar problems using
xrandr
for disabling/enabling the monitor.We did a fix in mm for the above problem (coming with next release) but I don’t know if this fixes your problem too.
You can find the fix in this PR.
Thank you, i updated the file, hope for the best :)
-
so far so good, no problems. so i can call it a fix for me.
Thanks