Question about alternating commands every minute in Cron

It sounds like you want crontab lines that execute a command at alternating minutes, like the first command at even minutes (0,2,4 etc.) and the second command at odd minutes (1,3,5 etc.).

This can be done in the following way:

0-59/2 * * * * export DISPLAY=:0 && xset dpms force off 

1-59/2 * * * * export DISPLAY=:0 && xset dpms force on

Explanation:

The minute entry here makes use of 2 different elements - ranges and step values.

The range has the format ?-?, so we define two different ranges, starting 1 minute apart (0-59 and 1-59).

The /2 part is the step value. By using this, we tell cron to only execute at every other value in the range.

By using the full possible minute range (but different starting values), we ensure that the commands run at every alternating minute, but 1 minute apart.

Fun fact:

The first range could also be entered as 0-58 and it wouldn't make a difference (since odd values are skipped in this range).