This story is unavailable.

Thanks for the article.

I am trying to write a cron schedule to turn my HDMI port for my Raspberry Pi on and off at different times during the day, depending on if its a weekend or week day.

To turn off the HDMI port I call: /home/pi/ off
To turn on the HDMI port I call: /home/pi/ off

I know how to setup the weekday AND weekend requests separate from one another.

My requirements: 
M-F: (turn it off all day, only back on when we get home after work)
Every day during the week I want the HDMI port on at 7AM, and off at 9AM. I want it back on when we get home at work from 5:00 PM and to turn off for the day at 11PM.

Sat-Sun: (leave it on all day)
On at 7AM, Off at 11PM.

So since I have a global on and off time of 7AM and 11PM every day we could say:
00 7 * * * * /home/pi/ on
00 23 * * * * /home/pi/ off

Then for the weekdays:
00 9 * * 1–5 /home/pi/ off (off at 9AM)
00 17 * * 1–5 /home/pi/ on (on at 5PM)

My question to you is one of order — how do I know if these will be executed in this order? Is there a better way to write this?


Like what you read? Give Lee McArthur a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.